*Fixed issue 1808

*Fixed issue with crashing carousel when switching from empty game list to none empty list.
*Added download for Full HQ & LQ Covers. When both are checked HQ Covers are prioritized.
*Added support for Full HQ & LQ Covers:
Full covers are currently used only in the GameInfo Screen (Press 2). The Box can be rotated in there with the Nunchuck. When the box is clicked it will jump to the midlle of the screen. Here it can be rotated with Nunchuck & Wiimote D-Pad. Also it can be zoomed in/out with the PLUS or MINUS buttons. Zoomed in covers are currently cut off when going too far into the screen because the axis had to be layed to the middle to keep the symmetry. Don't report issues about that. It's known. Another use of full covers might follow with a new layout if we think of something nice ;).
*Added support for different box colors. Box colors are taken from WiiTDB so if you get a wrong color complain at WiiTDB :P.
This commit is contained in:
dimok321 2011-01-30 16:22:16 +00:00
parent 2764ac6b76
commit 1d2854c777
29 changed files with 871 additions and 83 deletions

View File

@ -2,8 +2,8 @@
<app version="1">
<name> USB Loader GX</name>
<coder>USB Loader GX Team</coder>
<version>2.0 r1058</version>
<release_date>201101261855</release_date>
<version>2.0 r1059</version>
<release_date>201101282120</release_date>
<no_ios_reload/>
<short_description>Loads games from USB-devices</short_description>
<long_description>USB Loader GX is a libwiigui based USB iso loader with a wii-like GUI. You can install games to your HDDs and boot them with shorter loading times.

View File

@ -36,6 +36,7 @@ SOURCES := source \
source/prompts \
source/wad \
source/banner \
source/BoxCover \
source/cheats \
source/homebrewboot \
source/themes \

File diff suppressed because one or more lines are too long

View File

@ -1 +1 @@
<pd><ViewState><e p="gui\source\Controls" x="false"></e><e p="gui\source\mload" x="false"></e><e p="gui\source\settings" x="false"></e><e p="gui\source\utils" x="false"></e><e p="gui\source\SoundOperations" x="false"></e><e p="gui\source\images" x="false"></e><e p="gui\source\prompts" x="false"></e><e p="gui\source\banner" x="false"></e><e p="gui\source\cheats" x="false"></e><e p="gui\source\network" x="true"></e><e p="gui\source\fonts" x="false"></e><e p="gui\source\libs" x="false"></e><e p="gui\source\menu" x="false"></e><e p="gui\source\sounds" x="false"></e><e p="gui\source\system" x="false"></e><e p="gui\source\wad" x="false"></e><e p="gui" x="true"></e><e p="gui\source\FileOperations" x="false"></e><e p="gui\source\homebrewboot" x="false"></e><e p="gui\source\language" x="false"></e><e p="gui\source" x="true"></e><e p="gui\source\libwiigui" x="false"></e><e p="gui\source\patches" x="false"></e><e p="gui\source\themes" x="false"></e><e p="gui\source\ImageOperations" x="false"></e><e p="gui\source\memory" x="false"></e><e p="gui\source\usbloader" x="false"></e><e p="gui\source\xml" x="false"></e></ViewState></pd>
<pd><ViewState><e p="gui\source\Controls" x="false"></e><e p="gui\source\mload" x="false"></e><e p="gui\source\settings" x="false"></e><e p="gui\source\utils" x="false"></e><e p="gui\source\SoundOperations" x="false"></e><e p="gui\source\images" x="false"></e><e p="gui\source\prompts" x="false"></e><e p="gui\source\banner" x="false"></e><e p="gui\source\cheats" x="false"></e><e p="gui\source\network" x="true"></e><e p="gui\source\BoxCover" x="false"></e><e p="gui\source\fonts" x="false"></e><e p="gui\source\libs" x="false"></e><e p="gui\source\sounds" x="false"></e><e p="gui\source\wad" x="false"></e><e p="gui" x="true"></e><e p="gui\source\FileOperations" x="false"></e><e p="gui\source\homebrewboot" x="false"></e><e p="gui\source\language" x="false"></e><e p="gui\source" x="true"></e><e p="gui\source\libwiigui" x="false"></e><e p="gui\source\patches" x="false"></e><e p="gui\source\themes" x="false"></e><e p="gui\source\ImageOperations" x="false"></e><e p="gui\source\memory" x="false"></e><e p="gui\source\usbloader" x="false"></e><e p="gui\source\xml" x="false"></e><e p="gui\source\menu" x="false"></e><e p="gui\source\system" x="false"></e></ViewState></pd>

View File

@ -0,0 +1,317 @@
/****************************************************************************
* Copyright (C) 2011
* by Dimok
*
* This software is provided 'as-is', without any express or implied
* warranty. In no event will the authors be held liable for any
* damages arising from the use of this software.
*
* Permission is granted to anyone to use this software for any
* purpose, including commercial applications, and to alter it and
* redistribute it freely, subject to the following restrictions:
*
* 1. The origin of this software must not be misrepresented; you
* must not claim that you wrote the original software. If you use
* this software in a product, an acknowledgment in the product
* documentation would be appreciated but is not required.
*
* 2. Altered source versions must be plainly marked as such, and
* must not be misrepresented as being the original software.
*
* 3. This notice may not be removed or altered from any source
* distribution.
***************************************************************************/
#include "BoxCover.hpp"
#include "BoxMesh.hpp"
#include "themes/CTheme.h"
BoxCover::BoxCover(GuiImageData * img, bool flat)
: GuiImage(img),
boxBorder(Resources::GetFile("boxBorder.png"), Resources::GetFileSize("boxBorder.png")),
defaultBox(NULL)
{
flatCover = flat;
Zoomable = false;
RotX = 0.0f;
RotY = 0.0f;
RotZ = 0.0f;
PosX = 0.0f;
PosY = 0.0f;
PosZ = -4.5f;
BoxScale = 1.0f;
AnimRotate = 0.0f;
last_manual_move_frame = 0;
camera = (guVector) {0.0F, 0.0F, 0.0F};
up = (guVector) {0.0F, 1.0F, 0.0F};
look = (guVector) {0.0F, 0.0F, -1.0F};
boxColor = (GXColor) { 233, 233, 233, 255 };
guLookAt(view, &camera, &up, &look);
if(flatCover || !image)
{
defaultBox = Resources::GetImageData("nocoverFull.png");
GX_InitTexObj(&defaultBoxTex, defaultBox->GetImage(), defaultBox->GetWidth(), defaultBox->GetHeight(), defaultBox->GetTextureFormat(),GX_CLAMP, GX_CLAMP,GX_FALSE);
}
if(!image)
{
GX_InitTexObj(&coverTex, defaultBox->GetImage(), defaultBox->GetWidth(), defaultBox->GetHeight(), defaultBox->GetTextureFormat(),GX_CLAMP, GX_CLAMP,GX_FALSE);
flatCover = false;
}
else
GX_InitTexObj(&coverTex, image, width,height, GX_TF_RGBA8,GX_CLAMP, GX_CLAMP,GX_FALSE);
GX_InitTexObj(&boxBorderTex, boxBorder.GetImage(), boxBorder.GetWidth(), boxBorder.GetHeight(), boxBorder.GetTextureFormat(),GX_CLAMP, GX_CLAMP,GX_FALSE);
}
BoxCover::~BoxCover()
{
delete defaultBox;
}
void BoxCover::Update(GuiTrigger * t)
{
s8 movY = t->WPAD_Stick(0, 0) ;
s8 movX = t->WPAD_Stick(0, 1);
//! Drop nunchuck moves of less than 5 because of sensitivity
if(fabs(movY) < 5.0f) movY = 0;
if(fabs(movX) < 5.0f) movX = 0;
if(movY != 0 || movX != 0)
last_manual_move_frame = frameCount;
RotY += (f32) movY / 50.0f;
RotX -= (f32) movX / 50.0f;
if(Zoomable)
{
if(t->wpad.btns_h & WPAD_BUTTON_UP)
{
RotX -= 1.0f;
last_manual_move_frame = frameCount;
}
if(t->wpad.btns_h & WPAD_BUTTON_DOWN)
{
RotX += 1.0f;
last_manual_move_frame = frameCount;
}
if(t->wpad.btns_h & WPAD_BUTTON_LEFT)
{
RotY -= 1.0f;
last_manual_move_frame = frameCount;
}
if(t->wpad.btns_h & WPAD_BUTTON_RIGHT)
{
RotY += 1.0f;
last_manual_move_frame = frameCount;
}
if(t->wpad.btns_h & WPAD_BUTTON_PLUS)
{
if(PosZ < -3.4f)
PosZ += 0.1f;
else if(BoxScale < 2.4f)
BoxScale += 0.05f;
}
if(t->wpad.btns_h & WPAD_BUTTON_MINUS)
{
if(BoxScale > 1.0f)
BoxScale -= 0.05f;
else
{
BoxScale = 1.0f;
PosZ -= 0.1f;
if(PosZ < -6.0f) PosZ = -6.0f;
}
}
}
//! Stop movement for about 5 sec after manual move
if(frameCount-last_manual_move_frame < 250)
return;
Animation = sin(DegToRad(AnimRotate))*2.0f;
Animation2 = cos(DegToRad(AnimRotate))*5.0f;
AnimRotate += 0.1f;
if(AnimRotate > 360.0f)
AnimRotate = 0.0f;
}
void BoxCover::Draw()
{
u8 BoxAlpha = (int) (alpha+angleDyn) & 0xFF;
Mtx44 projection;
guPerspective(projection, 45, (f32)screenwidth/(f32)screenheight, fabs(PosZ)-1.3f > 1.0f ? fabs(PosZ)-1.3f : 1.0f, -300.0F);
GX_LoadProjectionMtx(projection, GX_PERSPECTIVE);
GX_SetTevOp(GX_TEVSTAGE0, GX_MODULATE);
GX_SetVtxDesc(GX_VA_POS, GX_INDEX8);
GX_SetVtxDesc(GX_VA_CLR0, GX_DIRECT);
GX_SetVtxDesc(GX_VA_TEX0, GX_INDEX8);
Mtx modelView;
Mtx modelView2;
Mtx modelView3;
guVector cubeAxis = {0,0,1};
guVector cubeAxis2 = {0,1,0};
guVector cubeAxis3 = {1,0,0};
guMtxIdentity(modelView);
guMtxRotAxisDeg(modelView3, &cubeAxis3, RotX-Animation2);
guMtxRotAxisDeg(modelView2, &cubeAxis2, RotY+Animation2+xoffsetDyn/2.0f);
guMtxRotAxisDeg(modelView, &cubeAxis, RotZ-Animation);
guMtxConcat(modelView3, modelView2, modelView2);
guMtxConcat(modelView2, modelView, modelView);
guMtxScaleApply(modelView, modelView, BoxScale, BoxScale, BoxScale);
guMtxTransApply(modelView, modelView, PosX+xoffsetDyn/680.0f, PosY+yoffsetDyn/680.0f, PosZ);
guMtxConcat(view,modelView,modelView);
GX_LoadPosMtxImm(modelView, GX_PNMTX0);
GX_InvalidateTexAll();
GX_LoadTexObj(&boxBorderTex, GX_TEXMAP0);
//! Border quads
GX_SetArray(GX_VA_POS, (void *) &g_boxMeshQ[0].pos, sizeof(g_boxMeshQ[0]));
GX_SetArray(GX_VA_TEX0, (void *) &g_boxMeshQ[0].texCoord, sizeof(g_boxMeshQ[0]));
GX_Begin(GX_QUADS, GX_VTXFMT0, g_boxMeshQSize);
for (u32 j = 0; j < g_boxMeshQSize; ++j)
{
GX_Position1x8(j);
GX_Color4u8(boxColor.r, boxColor.g, boxColor.b, BoxAlpha);
GX_TexCoord1x8(j);
}
GX_End();
//! Border triangles
GX_SetArray(GX_VA_POS, (void *) &g_boxMeshT[0].pos, sizeof(g_boxMeshT[0]));
GX_SetArray(GX_VA_TEX0, (void *) &g_boxMeshT[0].texCoord, sizeof(g_boxMeshT[0]));
GX_Begin(GX_TRIANGLES, GX_VTXFMT0, g_boxMeshTSize);
for (u32 j = 0; j < g_boxMeshTSize; ++j)
{
GX_Position1x8(j);
GX_Color4u8(boxColor.r, boxColor.g, boxColor.b, BoxAlpha);
GX_TexCoord1x8(j);
}
GX_End();
GX_LoadTexObj(flatCover ? &defaultBoxTex : &coverTex, GX_TEXMAP0);
//! Back Cover
GX_SetArray(GX_VA_POS, (void *) &g_boxBackCoverMesh[0].pos, sizeof(g_boxBackCoverMesh[0]));
GX_SetArray(GX_VA_TEX0, (void *) &g_boxBackCoverMesh[0].texCoord, sizeof(g_boxBackCoverMesh[0]));
GX_Begin(GX_QUADS, GX_VTXFMT0, g_boxBackCoverMeshSize);
for (u32 j = 0; j < g_boxBackCoverMeshSize; ++j)
{
GX_Position1x8(j);
if(flatCover)
GX_Color4u8(boxColor.r, boxColor.g, boxColor.b, BoxAlpha);
else
GX_Color4u8(0xff, 0xff, 0xff, BoxAlpha);
GX_TexCoord1x8(j);
}
GX_End();
if(flatCover)
{
//! Front Flat Cover
GX_LoadTexObj(&coverTex, GX_TEXMAP0);
GX_SetArray(GX_VA_POS, (void *) &g_flatCoverMesh[0].pos, sizeof(g_flatCoverMesh[0]));
GX_SetArray(GX_VA_TEX0, (void *) &g_flatCoverMesh[0].texCoord, sizeof(g_flatCoverMesh[0]));
GX_Begin(GX_QUADS, GX_VTXFMT0, g_flatCoverMeshSize);
for (u32 j = 0; j < g_flatCoverMeshSize; ++j)
{
GX_Position1x8(j);
GX_Color4u8(0xff, 0xff, 0xff, 0xff);
GX_TexCoord1x8(j);
}
GX_End();
}
else
{
//! Front Cover
GX_SetArray(GX_VA_POS, (void *) &g_boxCoverMesh[0].pos, sizeof(g_boxCoverMesh[0]));
GX_SetArray(GX_VA_TEX0, (void *) &g_boxCoverMesh[0].texCoord, sizeof(g_boxCoverMesh[0]));
GX_Begin(GX_QUADS, GX_VTXFMT0, g_boxCoverMeshSize);
for (u32 j = 0; j < g_boxCoverMeshSize; ++j)
{
GX_Position1x8(j);
GX_Color4u8(0xff, 0xff, 0xff, BoxAlpha);
GX_TexCoord1x8(j);
}
GX_End();
}
GX_SetVtxDesc(GX_VA_POS, GX_DIRECT);
GX_SetVtxDesc(GX_VA_CLR0, GX_DIRECT);
GX_SetVtxDesc(GX_VA_TEX0, GX_DIRECT);
GX_SetTevOp(GX_TEVSTAGE0, GX_PASSCLR);
UpdateEffects();
}
void BoxCover::SetEffect(int eff, int amount, int target)
{
GuiImage::SetEffect(eff, amount, target);
}
void BoxCover::UpdateEffects()
{
GuiImage::UpdateEffects();
if(effects & EFFECT_BOX_FLY_CENTRE)
{
if(PosX > 0.01f)
PosX -= effectAmount/1000.0f;
if(PosY > 0.01f)
PosY -= effectAmount/1000.0f;
if(PosX < -0.01f)
PosX += effectAmount/1000.0f;
if(PosY < -0.01f)
PosY += effectAmount/1000.0f;
PosZ += 0.1f;
RotY += effectAmount/4.9f;
if(fabs(PosX) < 0.1f && fabs(PosY) < 0.1f)
{
PosX = 0.0f;
PosY = 0.0f;
effects = 0;
effectAmount = 0;
}
}
else if(effects & EFFECT_BOX_FLY_BACK)
{
if(PosX > PosXOrig+0.1f)
PosX -= effectAmount/1000.0f;
if(PosY > PosYOrig+0.1f)
PosY -= effectAmount/1000.0f;
if(PosX < PosXOrig-0.1f)
PosX += effectAmount/1000.0f;
if(PosY < PosYOrig-0.1f)
PosY += effectAmount/1000.0f;
PosZ -= 0.1f;
RotY -= effectAmount/4.9f;
if(BoxScale > 1.0f)
BoxScale -= 0.08f;
if(fabs(PosXOrig-PosX) < 0.1f && fabs(PosYOrig-PosY) < 0.1f)
{
BoxScale = 1.0f;
PosX = PosXOrig;
PosY = PosYOrig;
PosZ = PosZOrig;
effects = 0;
effectAmount = 0;
}
}
}

View File

@ -0,0 +1,77 @@
/****************************************************************************
* Copyright (C) 2010
* by Dimok
*
* This software is provided 'as-is', without any express or implied
* warranty. In no event will the authors be held liable for any
* damages arising from the use of this software.
*
* Permission is granted to anyone to use this software for any
* purpose, including commercial applications, and to alter it and
* redistribute it freely, subject to the following restrictions:
*
* 1. The origin of this software must not be misrepresented; you
* must not claim that you wrote the original software. If you use
* this software in a product, an acknowledgment in the product
* documentation would be appreciated but is not required.
*
* 2. Altered source versions must be plainly marked as such, and
* must not be misrepresented as being the original software.
*
* 3. This notice may not be removed or altered from any source
* distribution.
***************************************************************************/
#ifndef BOX_COVER_HPP_
#define BOX_COVER_HPP_
#include "libwiigui/gui.h"
#define EFFECT_BOX_FLY_CENTRE 0x4000000
#define EFFECT_BOX_FLY_BACK 0x8000000
class BoxCover : public GuiImage
{
public:
BoxCover(GuiImageData * img, bool flat = false);
~BoxCover();
//! Colors:
//! Gray Box (Default): r:233 g:233 b:233
//! Red Box (NSMB): r:198 g:34 b:4
void SetBoxColor(GXColor c) { LOCK(this); boxColor = c; };
void SetPosition(f32 x, f32 y, f32 z) { LOCK(this); PosXOrig = PosX = x; PosYOrig = PosY = y; PosZOrig = PosZ = z; };
void SetEffect(int eff, int amount, int target = 0);
void SetImage(GuiImageData *img); //forbid this call
void SetZoomable(bool z) { LOCK(this); Zoomable = z; };
void Draw();
void Update(GuiTrigger * t);
void UpdateEffects();
private:
f32 RotX;
f32 RotY;
f32 RotZ;
f32 PosX;
f32 PosY;
f32 PosZ;
f32 PosXOrig;
f32 PosYOrig;
f32 PosZOrig;
f32 BoxScale;
f32 AnimRotate;
f32 Animation;
f32 Animation2;
u32 last_manual_move_frame;
bool flatCover;
bool Zoomable;
guVector camera, up, look;
GuiImageData boxBorder;
GuiImageData *defaultBox;
Mtx view;
GXTexObj coverTex;
GXTexObj boxBorderTex;
GXTexObj defaultBoxTex;
GXColor boxColor;
};
#endif

156
source/BoxCover/BoxMesh.cpp Normal file
View File

@ -0,0 +1,156 @@
#include <gccore.h>
#include "BoxMesh.hpp"
// Quick and dirty hardcoded DVD box mesh
static const guVector g_coverBL = { -0.65f, -0.915f, 0.f };
static const guVector g_coverTR = { 0.65f, 0.915f, 0.f };
static const float g_boxCoverY = 0.05f;
static const float g_boxBorderWidth = 0.022f;
static const guVector g_frontCoverBL = { g_coverBL.x, g_coverBL.y + g_boxCoverY, g_coverBL.z };
static const guVector g_frontCoverTR = { g_coverTR.x, g_coverTR.y + g_boxCoverY, g_coverTR.z };
static const guVector g_backCoverBL = { g_frontCoverBL.x, g_frontCoverBL.y, g_frontCoverBL.z - 0.16f };
static const guVector g_backCoverTR = { g_frontCoverTR.x, g_frontCoverTR.y, g_frontCoverTR.z - 0.16f };
const float g_boxCoverYCenter = (g_frontCoverTR.y - g_frontCoverBL.y) * 0.5f;
const float g_coverYCenter = (g_coverTR.y - g_coverBL.y) * 0.5f;
#define w(x) ((float)x / 64.0f)
#define h(y) ((float)y / 256.0f)
const SMeshVert g_boxMeshQ[] ATTRIBUTE_ALIGN(32) = { // Quads
// Bordure du bas devant
{ { g_frontCoverBL.x, g_frontCoverBL.y, g_frontCoverBL.z }, CTexCoord(w(0), h(256)) },
{ { g_frontCoverBL.x, g_frontCoverBL.y - g_boxBorderWidth, g_frontCoverBL.z - g_boxBorderWidth }, CTexCoord(w(10), h(224)) },
{ { g_frontCoverTR.x, g_frontCoverBL.y - g_boxBorderWidth, g_frontCoverBL.z - g_boxBorderWidth }, CTexCoord(w(10), h(224)) },
{ { g_frontCoverTR.x, g_frontCoverBL.y, g_frontCoverBL.z }, CTexCoord(w(0), h(224)) },
// Bordure du haut devant
{ { g_frontCoverBL.x, g_frontCoverTR.y + g_boxBorderWidth, g_frontCoverBL.z - g_boxBorderWidth }, CTexCoord(w(10), h(1)) },
{ { g_frontCoverBL.x, g_frontCoverTR.y, g_frontCoverBL.z }, CTexCoord(w(0), h(1)) },
{ { g_frontCoverTR.x, g_frontCoverTR.y, g_frontCoverBL.z }, CTexCoord(w(0), h(32)) },
{ { g_frontCoverTR.x, g_frontCoverTR.y + g_boxBorderWidth, g_frontCoverBL.z - g_boxBorderWidth }, CTexCoord(w(10), h(32)) },
// Bordure du bas derrière
{ { g_backCoverBL.x, g_backCoverBL.y - g_boxBorderWidth, g_backCoverBL.z + g_boxBorderWidth }, CTexCoord(w(54), h(256)) },
{ { g_backCoverBL.x, g_backCoverBL.y, g_backCoverBL.z }, CTexCoord(w(64), h(224)) },
{ { g_backCoverTR.x, g_backCoverBL.y, g_backCoverBL.z }, CTexCoord(w(64), h(224)) },
{ { g_backCoverTR.x, g_backCoverBL.y - g_boxBorderWidth, g_backCoverBL.z + g_boxBorderWidth }, CTexCoord(w(54), h(224)) },
// Bordure du haut derrière
{ { g_backCoverBL.x, g_backCoverTR.y, g_backCoverBL.z }, CTexCoord(w(64), h(1)) },
{ { g_backCoverBL.x, g_backCoverTR.y + g_boxBorderWidth, g_backCoverBL.z + g_boxBorderWidth }, CTexCoord(w(54), h(1)) },
{ { g_backCoverTR.x, g_backCoverTR.y + g_boxBorderWidth, g_backCoverBL.z + g_boxBorderWidth }, CTexCoord(w(54), h(32)) },
{ { g_backCoverTR.x, g_backCoverTR.y, g_backCoverBL.z }, CTexCoord(w(64), h(32)) },
// Bordure de droite devant
{ { g_frontCoverTR.x, g_frontCoverBL.y, g_frontCoverBL.z }, CTexCoord(w(0), h(256)) },
{ { g_frontCoverTR.x + g_boxBorderWidth, g_frontCoverBL.y, g_frontCoverBL.z - g_boxBorderWidth }, CTexCoord(w(10), h(256)) },
{ { g_frontCoverTR.x + g_boxBorderWidth, g_frontCoverTR.y, g_frontCoverBL.z - g_boxBorderWidth }, CTexCoord(w(10), h(0)) },
{ { g_frontCoverTR.x, g_frontCoverTR.y, g_frontCoverBL.z }, CTexCoord(w(0), h(0)) },
// Bordure de droite derrière
{ { g_backCoverTR.x + g_boxBorderWidth, g_backCoverBL.y, g_backCoverBL.z + g_boxBorderWidth }, CTexCoord(w(54), h(256)) },
{ { g_backCoverTR.x, g_backCoverBL.y, g_backCoverBL.z }, CTexCoord(w(64), h(256)) },
{ { g_backCoverTR.x, g_backCoverTR.y, g_backCoverBL.z }, CTexCoord(w(64), h(0)) },
{ { g_backCoverTR.x + g_boxBorderWidth, g_backCoverTR.y, g_backCoverBL.z + g_boxBorderWidth }, CTexCoord(w(54), h(0)) },
// Face du haut
{ { g_frontCoverBL.x, g_frontCoverTR.y + g_boxBorderWidth, g_frontCoverBL.z - g_boxBorderWidth }, CTexCoord(w(10), h(1)) },
{ { g_frontCoverTR.x, g_frontCoverTR.y + g_boxBorderWidth, g_frontCoverBL.z - g_boxBorderWidth }, CTexCoord(w(10), h(32)) },
{ { g_backCoverTR.x, g_backCoverTR.y + g_boxBorderWidth, g_backCoverBL.z + g_boxBorderWidth }, CTexCoord(w(54), h(32)) },
{ { g_backCoverBL.x, g_backCoverTR.y + g_boxBorderWidth, g_backCoverBL.z + g_boxBorderWidth }, CTexCoord(w(54), h(1)) },
// Angle face du haut / face de droite
{ { g_frontCoverTR.x, g_frontCoverTR.y + g_boxBorderWidth, g_frontCoverBL.z - g_boxBorderWidth }, CTexCoord(w(10), h(32)) },
{ { g_frontCoverTR.x + g_boxBorderWidth, g_frontCoverTR.y, g_frontCoverBL.z - g_boxBorderWidth }, CTexCoord(w(10), h(0)) },
{ { g_backCoverTR.x + g_boxBorderWidth, g_backCoverTR.y, g_backCoverBL.z + g_boxBorderWidth }, CTexCoord(w(54), h(0)) },
{ { g_backCoverTR.x, g_backCoverTR.y + g_boxBorderWidth, g_backCoverBL.z + g_boxBorderWidth }, CTexCoord(w(54), h(32)) },
// Face de droite
{ { g_frontCoverTR.x + g_boxBorderWidth, g_frontCoverTR.y, g_frontCoverBL.z - g_boxBorderWidth }, CTexCoord(w(10), h(0)) },
{ { g_frontCoverTR.x + g_boxBorderWidth, g_frontCoverBL.y, g_frontCoverBL.z - g_boxBorderWidth }, CTexCoord(w(10), h(256)) },
{ { g_backCoverTR.x + g_boxBorderWidth, g_backCoverBL.y, g_backCoverBL.z + g_boxBorderWidth }, CTexCoord(w(54), h(256)) },
{ { g_backCoverTR.x + g_boxBorderWidth, g_backCoverTR.y, g_backCoverBL.z + g_boxBorderWidth }, CTexCoord(w(54), h(0)) },
// Angle face de droite / face du bas
{ { g_frontCoverTR.x + g_boxBorderWidth, g_frontCoverBL.y, g_frontCoverBL.z - g_boxBorderWidth }, CTexCoord(w(10), h(256)) },
{ { g_frontCoverTR.x, g_frontCoverBL.y - g_boxBorderWidth, g_frontCoverBL.z - g_boxBorderWidth }, CTexCoord(w(10), h(224)) },
{ { g_backCoverTR.x, g_backCoverBL.y - g_boxBorderWidth, g_backCoverBL.z + g_boxBorderWidth }, CTexCoord(w(54), h(224)) },
{ { g_backCoverTR.x + g_boxBorderWidth, g_backCoverBL.y, g_backCoverBL.z + g_boxBorderWidth }, CTexCoord(w(54), h(256)) },
// Face du bas
{ { g_frontCoverTR.x, g_frontCoverBL.y - g_boxBorderWidth, g_frontCoverBL.z - g_boxBorderWidth }, CTexCoord(w(10), h(224)) },
{ { g_frontCoverBL.x, g_frontCoverBL.y - g_boxBorderWidth, g_frontCoverBL.z - g_boxBorderWidth }, CTexCoord(w(10), h(224)) },
{ { g_backCoverBL.x, g_backCoverBL.y - g_boxBorderWidth, g_backCoverBL.z + g_boxBorderWidth }, CTexCoord(w(54), h(256)) },
{ { g_backCoverTR.x, g_backCoverBL.y - g_boxBorderWidth, g_backCoverBL.z + g_boxBorderWidth }, CTexCoord(w(54), h(224)) },
// Face de gauche en haut
{ { g_frontCoverBL.x, g_frontCoverTR.y, g_frontCoverBL.z }, CTexCoord(w(1), h(1)) },
{ { g_frontCoverBL.x, g_frontCoverTR.y + g_boxBorderWidth, g_frontCoverBL.z - g_boxBorderWidth }, CTexCoord(w(1), h(1)) },
{ { g_backCoverBL.x, g_backCoverTR.y + g_boxBorderWidth, g_backCoverBL.z + g_boxBorderWidth }, CTexCoord(w(1), h(1)) },
{ { g_backCoverBL.x, g_backCoverTR.y, g_backCoverBL.z}, CTexCoord(w(1), h(1)) },
// Face de gauche en bas
{ { g_frontCoverBL.x, g_frontCoverBL.y - g_boxBorderWidth, g_frontCoverBL.z - g_boxBorderWidth }, CTexCoord(w(1), h(1)) },
{ { g_frontCoverBL.x, g_frontCoverBL.y, g_frontCoverBL.z }, CTexCoord(w(1), h(1)) },
{ { g_backCoverBL.x, g_backCoverBL.y, g_backCoverBL.z }, CTexCoord(w(1), h(1)) },
{ { g_backCoverBL.x, g_backCoverBL.y - g_boxBorderWidth, g_backCoverBL.z + g_boxBorderWidth }, CTexCoord(w(1), h(1)) },
};
const SMeshVert g_boxMeshT[] ATTRIBUTE_ALIGN(32) = { // Triangles
// Haut devant
{ { g_frontCoverTR.x, g_frontCoverTR.y, g_frontCoverBL.z }, CTexCoord(w(0), h(16)) },
{ { g_frontCoverTR.x + g_boxBorderWidth, g_frontCoverTR.y, g_frontCoverBL.z - g_boxBorderWidth }, CTexCoord(w(10), h(0)) },
{ { g_frontCoverTR.x, g_frontCoverTR.y + g_boxBorderWidth, g_frontCoverBL.z - g_boxBorderWidth }, CTexCoord(w(10), h(32)) },
// Haut derrière
{ { g_backCoverTR.x, g_backCoverTR.y, g_backCoverBL.z }, CTexCoord(w(64), h(16)) },
{ { g_backCoverTR.x, g_backCoverTR.y + g_boxBorderWidth, g_backCoverBL.z + g_boxBorderWidth }, CTexCoord(w(54), h(32)) },
{ { g_backCoverTR.x + g_boxBorderWidth, g_backCoverTR.y, g_backCoverBL.z + g_boxBorderWidth }, CTexCoord(w(54), h(0)) },
// Bas devant
{ { g_frontCoverTR.x, g_frontCoverBL.y, g_frontCoverBL.z }, CTexCoord(w(0), h(240)) },
{ { g_frontCoverTR.x, g_frontCoverBL.y - g_boxBorderWidth, g_frontCoverBL.z - g_boxBorderWidth }, CTexCoord(w(10), h(224)) },
{ { g_frontCoverTR.x + g_boxBorderWidth, g_frontCoverBL.y, g_frontCoverBL.z - g_boxBorderWidth }, CTexCoord(w(10), h(256)) },
// Bas derrière
{ { g_backCoverTR.x, g_backCoverBL.y, g_backCoverBL.z }, CTexCoord(w(64), h(240)) },
{ { g_backCoverTR.x + g_boxBorderWidth, g_backCoverBL.y, g_backCoverBL.z + g_boxBorderWidth }, CTexCoord(w(54), h(256)) },
{ { g_backCoverTR.x, g_backCoverBL.y - g_boxBorderWidth, g_backCoverBL.z + g_boxBorderWidth }, CTexCoord(w(54), h(224)) }
};
#undef h
#undef w
const SMeshVert g_flatCoverMesh[] ATTRIBUTE_ALIGN(32) = {
{ { g_frontCoverBL.x, g_frontCoverBL.y, g_frontCoverBL.z }, CTexCoord(0.f, 1.f) },
{ { g_frontCoverTR.x, g_frontCoverBL.y, g_frontCoverBL.z }, CTexCoord(1.f, 1.f) },
{ { g_frontCoverTR.x, g_frontCoverTR.y, g_frontCoverBL.z }, CTexCoord(1.f, 0.f) },
{ { g_frontCoverBL.x, g_frontCoverTR.y, g_frontCoverBL.z }, CTexCoord(0.f, 0.f) },
};
const SMeshVert g_boxBackCoverMesh[] ATTRIBUTE_ALIGN(32) = {
{ { g_backCoverTR.x, g_backCoverBL.y, g_backCoverBL.z }, CTexCoord(0.f, 1.f) },
{ { g_backCoverBL.x, g_backCoverBL.y, g_backCoverBL.z }, CTexCoord(1.3f / 2.76f, 1.f) },
{ { g_backCoverBL.x, g_backCoverTR.y, g_backCoverBL.z }, CTexCoord(1.3f / 2.76f, 0.f) },
{ { g_backCoverTR.x, g_backCoverTR.y, g_backCoverBL.z }, CTexCoord(0.f, 0.f) },
{ { g_frontCoverBL.x, g_frontCoverBL.y, g_frontCoverBL.z }, CTexCoord(1.46f / 2.76f, 1.f) },
{ { g_frontCoverBL.x, g_frontCoverTR.y, g_frontCoverBL.z }, CTexCoord(1.46f / 2.76f, 0.f) },
{ { g_backCoverBL.x, g_backCoverTR.y, g_backCoverBL.z }, CTexCoord(1.3f / 2.76f, 0.f) },
{ { g_backCoverBL.x, g_backCoverBL.y, g_backCoverBL.z }, CTexCoord(1.3f / 2.76f, 1.f) },
};
const SMeshVert g_boxCoverMesh[] ATTRIBUTE_ALIGN(32) = {
{ { g_frontCoverBL.x, g_frontCoverBL.y, g_frontCoverBL.z }, CTexCoord(1.46f / 2.76f, 1.f) },
{ { g_frontCoverTR.x, g_frontCoverBL.y, g_frontCoverBL.z }, CTexCoord(1.f, 1.f) },
{ { g_frontCoverTR.x, g_frontCoverTR.y, g_frontCoverBL.z }, CTexCoord(1.f, 0.f) },
{ { g_frontCoverBL.x, g_frontCoverTR.y, g_frontCoverBL.z }, CTexCoord(1.46f / 2.76f, 0.f) }
};
const u32 g_flatCoverMeshSize = sizeof g_flatCoverMesh / sizeof g_flatCoverMesh[0];
const u32 g_boxMeshQSize = sizeof g_boxMeshQ / sizeof g_boxMeshQ[0];
const u32 g_boxMeshTSize = sizeof g_boxMeshT / sizeof g_boxMeshT[0];
const u32 g_boxCoverMeshSize = sizeof g_boxCoverMesh / sizeof g_boxCoverMesh[0];
const u32 g_boxBackCoverMeshSize = sizeof g_boxBackCoverMesh / sizeof g_boxBackCoverMesh[0];

View File

@ -0,0 +1,45 @@
#ifndef BOXMESH_HPP_
#define BOXMESH_HPP_
//Box mesh from hibern
// Quick and dirty hardcoded DVD box mesh
// Should be replaced by a true mesh loader
// Lacks normals
class CTexCoord
{
public:
float x;
float y;
public:
CTexCoord(void) { x = 0.f; y = 0.f; }
CTexCoord(float px, float py) { x = px; y = py; }
};
struct SMeshVert
{
guVector pos;
CTexCoord texCoord;
};
// Flat cover
extern const SMeshVert g_flatCoverMesh[];
extern const u32 g_flatCoverMeshSize;
// Box
extern const SMeshVert g_boxMeshQ[]; // Quads
extern const u32 g_boxMeshQSize;
extern const SMeshVert g_boxMeshT[]; // Triangles
extern const u32 g_boxMeshTSize;
// Box cover
extern const SMeshVert g_boxBackCoverMesh[];
extern const u32 g_boxBackCoverMeshSize;
extern const SMeshVert g_boxCoverMesh[];
extern const u32 g_boxCoverMeshSize;
//
extern const float g_boxCoverYCenter;
extern const float g_coverYCenter;
#endif

View File

@ -29,7 +29,8 @@
#include <string.h>
#include <string>
#include <algorithm>
#include <sys/dir.h>
#include <sys/stat.h>
#include <sys/dirent.h>
#include "utils/StringTools.h"
#include "DirList.h"
@ -51,7 +52,8 @@ bool DirList::LoadPath(const char * folder, const char *filter, u32 flags)
return false;
struct stat st;
DIR_ITER *dir = NULL;
struct dirent *dirent = NULL;
DIR *dir = NULL;
std::string folderpath = folder;
if(folderpath[folderpath.size()-1] == '/')
@ -61,19 +63,26 @@ bool DirList::LoadPath(const char * folder, const char *filter, u32 flags)
if(!notRoot)
folderpath += '/';
dir = diropen(folderpath.c_str());
dir = opendir(folderpath.c_str());
if (dir == NULL)
return false;
char * filename = new (std::nothrow) char[1024];
if(!filename)
{
dirclose(dir);
closedir(dir);
return false;
}
while (dirnext(dir,filename,&st) == 0)
while ((dirent = readdir(dir)) != 0)
{
snprintf(filename, 1024, "%s/%s", folderpath.c_str(), dirent->d_name);
if(stat(filename, &st) != 0)
continue;
snprintf(filename, 1024, dirent->d_name);
if(st.st_mode & S_IFDIR)
{
if(!(flags & Dirs))
@ -110,7 +119,7 @@ bool DirList::LoadPath(const char * folder, const char *filter, u32 flags)
AddEntrie(folderpath.c_str(), filename, st.st_size, (st.st_mode & S_IFDIR) ? true : false);
}
}
dirclose(dir);
closedir(dir);
delete [] filename;
return true;

View File

@ -523,16 +523,13 @@ extern const u32 unlock_png_size;
extern const u8 unlock_gray_png[];
extern const u32 unlock_gray_png_size;
extern const u8 boxBorder_png[];
extern const u32 boxBorder_png_size;
extern const u8 nocoverFull_png[];
extern const u32 nocoverFull_png_size;
extern const u8 stub_bin[];
extern const u32 stub_bin_size;
extern const u8 fatffs_module_bin[];
extern const u32 fatffs_module_bin_size;
extern const u8 ehcmodule_frag_v4_bin[];
extern const u32 ehcmodule_frag_v4_bin_size;
extern const u8 ehcmodule_frag_v5_bin[];
extern const u32 ehcmodule_frag_v5_bin_size;
#endif

BIN
source/images/boxBorder.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.6 KiB

View File

@ -28,12 +28,21 @@ GuiCircle::GuiCircle()
{
color = (GXColor) {0, 0, 0, 255};
SetLinewidth(1.0f);
}
GuiCircle::GuiCircle(float r)
: radius(r), filled(true), accuracy(36)
{
color = (GXColor) {0, 0, 0, 255};
SetLinewidth(1.0f);
}
void GuiCircle::SetLinewidth(float s)
{
LOCK(this);
Linewidth = s;
GX_SetLineWidth((u8) (s*6.0f), 0);
}
void GuiCircle::Draw()

View File

@ -32,13 +32,16 @@ class GuiCircle : public GuiElement
GuiCircle();
GuiCircle(float radius);
void SetRadius(float r) { LOCK(this); radius = r; }
void SetInnerRadius(float r) { SetLinewidth((radius-r)*2.0f); }
void SetColor(const GXColor c) { LOCK(this); color = c; }
void SetAccuracy(int a) { LOCK(this); accuracy = a; }
void SetFilled(bool f) { LOCK(this); filled = f; }
void SetLinewidth(float s);
void Draw();
protected:
GXColor color;
float radius;
float Linewidth;
bool filled;
int accuracy;
};

View File

@ -30,24 +30,13 @@ void GuiCross::Draw()
f32 y1 = GetTop();
f32 y2 = y1 + height;
GX_Begin(GX_TRIANGLEFAN, GX_VTXFMT0, 4);
GX_Begin(GX_LINES, GX_VTXFMT0, 4);
GX_Position3f32(x1, y1, 0.0f);
GX_Color4u8(color.r, color.g, color.b, color.a);
GX_Position3f32(x1-Linewidth, y1+Linewidth, 0.0f);
GX_Color4u8(color.r, color.g, color.b, color.a);
GX_Position3f32(x2-Linewidth, y2+Linewidth, 0.0f);
GX_Color4u8(color.r, color.g, color.b, color.a);
GX_Position3f32(x2, y2, 0.0f);
GX_Color4u8(color.r, color.g, color.b, color.a);
GX_End();
GX_Begin(GX_TRIANGLEFAN, GX_VTXFMT0, 4);
GX_Position3f32(x2, y1, 0.0f);
GX_Color4u8(color.r, color.g, color.b, color.a);
GX_Position3f32(x2+Linewidth, y1+Linewidth, 0.0f);
GX_Color4u8(color.r, color.g, color.b, color.a);
GX_Position3f32(x1+Linewidth, y2+Linewidth, 0.0f);
GX_Color4u8(color.r, color.g, color.b, color.a);
GX_Position3f32(x1, y2, 0.0f);
GX_Color4u8(color.r, color.g, color.b, color.a);
GX_End();

View File

@ -29,8 +29,9 @@
class GuiCross : public GuiElement
{
public:
GuiCross() : Linewidth(1.5f) { color = (GXColor) {0, 0, 0, 255}; }
void SetLinewidth(float w) { LOCK(this); Linewidth = w; }
GuiCross() : Linewidth(2.0f) { color = (GXColor) {0, 0, 0, 255}; GX_SetLineWidth((u8) (Linewidth*6.0f), 0); }
//! Max line width is 42.5 pixel
void SetLinewidth(float w) { LOCK(this); Linewidth = w; GX_SetLineWidth((u8) (Linewidth*6.0f), 0); }
void SetColor(const GXColor c) { LOCK(this); color = c; }
void SetSize(int w, int h) { LOCK(this); width = w; height = h; }
void Draw();

View File

@ -265,7 +265,7 @@ void GuiGameCarousel::Draw()
void GuiGameCarousel::Update(GuiTrigger * t)
{
LOCK( this );
if (state == STATE_DISABLED || !t || !gameList.size()) return;
if (state == STATE_DISABLED || !t || !gameList.size() || !pagesize) return;
btnRight->Update(t);
btnLeft->Update(t);

View File

@ -10,9 +10,12 @@
#include "language/gettext.h"
#include "usbloader/GetMissingGameFiles.hpp"
#include "utils/StringTools.h"
#include "gecko.h"
#define VALID_IMAGE(x) (!(x.size == 36864 || x.size <= 1024 || x.size == 7386 || x.size <= 1174 || x.size == 4446 || x.data == NULL))
const char * serverURLFull = "http://wiitdb.com/wiitdb/artwork/coverfull/";
const char * serverURLFullHQ = "http://wiitdb.com/wiitdb/artwork/coverfullHQ/";
const char * serverURL3D = "http://wiitdb.com/wiitdb/artwork/cover3D/";
const char * serverURL2D = "http://wiitdb.com/wiitdb/artwork/cover/";
const char * serverURLOrigDiscs = "http://wiitdb.com/wiitdb/artwork/disc/";
@ -175,7 +178,10 @@ static int CoverDownloader(const char * downloadURL, const char *writepath, cons
}
if (!IsNetworkInit() && !NetworkInitPrompt())
{
gprintf("No network\n");
return -1;
}
if(!skipPrompt)
{
@ -188,19 +194,24 @@ static int CoverDownloader(const char * downloadURL, const char *writepath, cons
AbortRequested = false;
gprintf("CoverDownloadWithProgress - downloadURL: %s progressTitle: %s writepath: %s MissingFiles: %i\n", downloadURL, progressTitle, writepath, MissingFilesList.size());
return CoverDownloadWithProgress(downloadURL, progressTitle, writepath, MissingFilesList);
}
void CoverDownload()
{
int choice = CheckboxWindow(tr( "Cover Download" ), 0, tr( "3D Covers" ), tr( "Flat Covers" ), tr( "Original Disc Images" ), tr( "Custom Disc Images" )); // ask for download choice
int choice = CheckboxWindow(tr( "Cover Download" ), 0, tr( "3D Covers" ), tr( "Flat Covers" ), tr("Full HQ Covers"), tr("Full LQ Covers"), tr( "Original Discarts" ), tr( "Custom Discarts" )); // ask for download choice
if (choice == 0)
return;
bool skipPrompt = false;
int FileSkipped = 0;
int SkippedFull = 0;
int SkippedDiscArts = 0;
gprintf("CoverDownload start - choices: %04X\n", choice);
if(choice & CheckedBox1)
{
int ret = CoverDownloader(serverURL3D, Settings.covers_path, tr("Downloading 3D Covers"), tr("Download Boxart image?"), skipPrompt);
@ -216,6 +227,20 @@ void CoverDownload()
skipPrompt = true;
}
if(choice & CheckedBox3)
{
int ret = CoverDownloader(serverURLFullHQ, Settings.coversFull_path, tr("Downloading Full HQ Covers"), tr("Download Boxart image?"), skipPrompt);
if(ret > 0)
SkippedFull = ret;
skipPrompt = true;
}
if(choice & CheckedBox4)
{
int ret = CoverDownloader(serverURLFull, Settings.coversFull_path, tr("Downloading Full LQ Covers"), tr("Download Boxart image?"), skipPrompt);
if(ret > 0)
SkippedFull = ret;
skipPrompt = true;
}
if(choice & CheckedBox5)
{
skipPrompt = true;
const char * downloadURL = (Settings.discart == DISCARTS_ORIGINALS_CUSTOMS) ? serverURLOrigDiscs : serverURLCustomDiscs;
@ -224,7 +249,7 @@ void CoverDownload()
if(ret > 0)
SkippedDiscArts = ret;
}
if(choice & CheckedBox4)
if(choice & CheckedBox6)
{
skipPrompt = true;
const char * downloadURL = (Settings.discart == DISCARTS_ORIGINALS_CUSTOMS) ? serverURLCustomDiscs : serverURLOrigDiscs;
@ -234,7 +259,7 @@ void CoverDownload()
SkippedDiscArts = ret;
}
FileSkipped += SkippedDiscArts;
FileSkipped += SkippedDiscArts+SkippedFull;
if (FileSkipped == 0)
{

View File

@ -59,7 +59,7 @@ CheckboxPrompt::~CheckboxPrompt()
void CheckboxPrompt::AddCheckBox(const char *text)
{
int size = Checkbox.size();
if(size > 3)
if(size > 5)
return;
CheckboxTxt.resize(size+1);
@ -67,7 +67,7 @@ void CheckboxPrompt::AddCheckBox(const char *text)
CheckboxTxt[size] = new GuiText(text, 20, thColor("r=0 g=0 b=0 a=255 - prompt windows text color"));
CheckboxTxt[size]->SetAlignment(ALIGN_LEFT, ALIGN_MIDDLE);
CheckboxTxt[size]->SetPosition(40, 0);
CheckboxTxt[size]->SetPosition(30, 0);
Checkbox[size] = new GuiCheckbox(24, 24);
Checkbox[size]->SetLabel(CheckboxTxt[size]);
@ -81,22 +81,32 @@ void CheckboxPrompt::AddCheckBox(const char *text)
if(size == 0)
{
Checkbox[size]->SetAlignment(ALIGN_LEFT, ALIGN_BOTTOM);
Checkbox[size]->SetPosition(80, -170);
Checkbox[size]->SetPosition(80, -190);
}
else if(size == 1)
{
Checkbox[size]->SetAlignment(ALIGN_LEFT, ALIGN_BOTTOM);
Checkbox[size]->SetPosition(80, -115);
Checkbox[size]->SetPosition(80, -150);
}
else if(size == 2)
{
Checkbox[size]->SetAlignment(ALIGN_RIGHT, ALIGN_BOTTOM);
Checkbox[size]->SetPosition(-210, -170);
Checkbox[size]->SetAlignment(ALIGN_LEFT, ALIGN_BOTTOM);
Checkbox[size]->SetPosition(80, -110);
}
else if(size == 3)
{
Checkbox[size]->SetAlignment(ALIGN_RIGHT, ALIGN_BOTTOM);
Checkbox[size]->SetPosition(-210, -115);
Checkbox[size]->SetPosition(-210, -190);
}
else if(size == 4)
{
Checkbox[size]->SetAlignment(ALIGN_RIGHT, ALIGN_BOTTOM);
Checkbox[size]->SetPosition(-210, -150);
}
else if(size == 5)
{
Checkbox[size]->SetAlignment(ALIGN_RIGHT, ALIGN_BOTTOM);
Checkbox[size]->SetPosition(-210, -110);
}
}
else
@ -104,22 +114,32 @@ void CheckboxPrompt::AddCheckBox(const char *text)
if(size == 0)
{
Checkbox[size]->SetAlignment(ALIGN_LEFT, ALIGN_BOTTOM);
Checkbox[size]->SetPosition(40, -170);
Checkbox[size]->SetPosition(40, -190);
}
else if(size == 1)
{
Checkbox[size]->SetAlignment(ALIGN_LEFT, ALIGN_BOTTOM);
Checkbox[size]->SetPosition(40, -115);
Checkbox[size]->SetPosition(40, -150);
}
else if(size == 2)
{
Checkbox[size]->SetAlignment(ALIGN_RIGHT, ALIGN_BOTTOM);
Checkbox[size]->SetPosition(-210, -170);
Checkbox[size]->SetAlignment(ALIGN_LEFT, ALIGN_BOTTOM);
Checkbox[size]->SetPosition(40, -110);
}
else if(size == 3)
{
Checkbox[size]->SetAlignment(ALIGN_RIGHT, ALIGN_BOTTOM);
Checkbox[size]->SetPosition(-210, -115);
Checkbox[size]->SetPosition(-210, -190);
}
else if(size == 4)
{
Checkbox[size]->SetAlignment(ALIGN_RIGHT, ALIGN_BOTTOM);
Checkbox[size]->SetPosition(-210, -150);
}
else if(size == 5)
{
Checkbox[size]->SetAlignment(ALIGN_RIGHT, ALIGN_BOTTOM);
Checkbox[size]->SetPosition(-210, -110);
}
}
}
@ -149,7 +169,10 @@ int CheckboxPrompt::GetChoice()
}
int CheckboxPrompt::Show(const char *title, const char *msg, const char *chbx1, const char *chbx2, const char *chbx3, const char *chbx4)
int CheckboxPrompt::Show(const char *title, const char *msg,
const char *chbx1, const char *chbx2,
const char *chbx3, const char *chbx4,
const char *chbx5, const char *chbx6)
{
CheckboxPrompt * Window = new CheckboxPrompt(title, msg);
if(chbx1)
@ -160,6 +183,10 @@ int CheckboxPrompt::Show(const char *title, const char *msg, const char *chbx1,
Window->AddCheckBox(chbx3);
if(chbx4)
Window->AddCheckBox(chbx4);
if(chbx5)
Window->AddCheckBox(chbx5);
if(chbx6)
Window->AddCheckBox(chbx6);
mainWindow->SetState(STATE_DISABLED);
mainWindow->Append(Window);

View File

@ -33,6 +33,8 @@ enum
CheckedBox2 = 0x02,
CheckedBox3 = 0x04,
CheckedBox4 = 0x08,
CheckedBox5 = 0x10,
CheckedBox6 = 0x20,
};
class CheckboxPrompt : private PromptWindow
@ -47,7 +49,10 @@ class CheckboxPrompt : private PromptWindow
//! Default function to get the button pressed
int GetChoice();
//! Show window and wait for the user to press OK/Cancel
static int Show(const char *title = 0, const char *msg = 0, const char *chbx1 = 0, const char *chbx2 = 0, const char *chbx3 = 0, const char *chbx4 = 0);
static int Show(const char *title = 0, const char *msg = 0,
const char *chbx1 = 0, const char *chbx2 = 0,
const char *chbx3 = 0, const char *chbx4 = 0,
const char *chbx5 = 0, const char *chbx6 = 0);
protected:
std::vector<GuiText *> CheckboxTxt;
std::vector<GuiCheckbox *> Checkbox;

View File

@ -580,7 +580,7 @@ int GameWindow::MainLoop()
{
if(FavoriteBtn[i]->GetState() == STATE_CLICKED)
{
struct discHdr * header = (mountMethod ? dvdheader : gameList[gameSelected]);
struct discHdr * header = (mountMethod ? dvdheader : gameList[gameSelected]);
int FavoriteRank = (i+1 == GameStatistics.GetFavoriteRank(header->id)) ? 0 : i+1; // Press the current rank to reset the rank
GameStatistics.SetFavoriteRank(header->id, FavoriteRank);

View File

@ -688,7 +688,7 @@ int WindowExitPrompt()
GuiButton btn1(&btn1Img, &btn1OverImg, 0, 3, 0, 0, &trigA, btnSoundOver, btnSoundClick2, 0);
btn1.SetEffect(EFFECT_SLIDE_TOP | EFFECT_SLIDE_IN, 50);
GuiText btn2Txt(tr( "Homebrew Channel" ), 28, ( GXColor ) {0, 0, 0, 255});
GuiText btn2Txt(tr( "Homebrew Channel" ), 26, ( GXColor ) {0, 0, 0, 255});
if (Settings.HomeMenu == HOME_MENU_SYSTEM)
{
btn2Txt.SetText(tr( "Wii Menu" ));
@ -709,7 +709,7 @@ int WindowExitPrompt()
btn2.SetRumble(false);
btn2.SetPosition(-150, 0);
GuiText btn3Txt(tr( "Wii Menu" ), 28, ( GXColor ) {0, 0, 0, 255});
GuiText btn3Txt(tr( "Wii Menu" ), 26, ( GXColor ) {0, 0, 0, 255});
if (Settings.HomeMenu == HOME_MENU_SYSTEM)
{
btn3Txt.SetText(tr( "Reset" ));

View File

@ -23,6 +23,7 @@
#include "gecko.h"
#include "xml/WiiTDB.hpp"
#include "utils/ShowError.h"
#include "BoxCover/BoxCover.hpp"
/****************************************************************************
* gameinfo
@ -71,6 +72,7 @@ int showGameInfo(char *ID)
int newline = 1;
u8 page = 1;
BoxCover * boxCov = NULL;
GuiImageData * playersImgData = NULL;
GuiImage * playersImg = NULL;
@ -101,7 +103,6 @@ int showGameInfo(char *ID)
GuiImage * dialogBoxImg33 = NULL;
GuiImage * dialogBoxImg44 = NULL;
GuiImage * coverImg = NULL;
GuiImage * coverImg2 = NULL;
GuiImageData * classiccontrollerImgData = NULL;
GuiImageData * nunchukImgData = NULL;
@ -168,9 +169,17 @@ int showGameInfo(char *ID)
backBtn.SetTrigger(&trigB);
gameinfoWindow.Append(&backBtn);
GuiButton nextBtn(0, 0);
nextBtn.SetPosition(20, 20);
nextBtn.SetTrigger(&trigA);
GuiTrigger trigA_Simple;
trigA_Simple.SetSimpleTrigger(-1, WPAD_BUTTON_A | WPAD_CLASSIC_BUTTON_A, PAD_BUTTON_A);
GuiButton coverBtn(180, 250);
coverBtn.SetPosition(20, 20);
coverBtn.SetTrigger(&trigA_Simple);
gameinfoWindow.Append(&coverBtn);
GuiButton nextBtn(400, 300);
nextBtn.SetPosition(200, 20);
nextBtn.SetTrigger(&trigA_Simple);
gameinfoWindow.Append(&nextBtn);
//buttons for scrolling the synopsis
@ -185,6 +194,7 @@ int showGameInfo(char *ID)
GuiButton homeBtn(0, 0);
homeBtn.SetPosition(0, 0);
homeBtn.SetTrigger(&trigH);
gameinfoWindow.Append(&homeBtn);
char linebuf2[100] = "";
@ -308,21 +318,52 @@ int showGameInfo(char *ID)
gameinfoWindow.Append(dialogBoxImg3);
gameinfoWindow.Append(dialogBoxImg4);
bool loadFlatCover = false;
bool load3DCover = false;
char imgPath[150];
snprintf(imgPath, sizeof(imgPath), "%s%s.png", Settings.covers_path, ID);
snprintf(imgPath, sizeof(imgPath), "%s/%s.png", Settings.coversFull_path, ID);
if(!CheckFile(imgPath))
{
loadFlatCover = true;
snprintf(imgPath, sizeof(imgPath), "%s/%s.png", Settings.covers2d_path, ID);
}
if(!CheckFile(imgPath))
{
loadFlatCover = false;
load3DCover = true;
snprintf(imgPath, sizeof(imgPath), "%s/%s.png", Settings.covers_path, ID);
}
cover = new GuiImageData(imgPath); //load full id image
if (!cover->GetImage())
{
delete cover;
cover = Resources::GetImageData("nocover.png");
cover = NULL;
}
delete coverImg;
coverImg = NULL;
coverImg = new GuiImage(cover);
coverImg->SetWidescreen(Settings.widescreen);
coverImg->SetPosition(15, 30);
gameinfoWindow.Append(coverImg);
if(load3DCover && cover) //! No cover is always 3D box
{
coverImg = new GuiImage(cover);
coverImg->SetWidescreen(Settings.widescreen);
coverImg->SetPosition(15, 30);
}
else
{
boxCov = new BoxCover(cover, loadFlatCover);
boxCov->SetPosition(-1.75f, 0.4f, -5.0f);
boxCov->SetEffect(EFFECT_SLIDE_LEFT | EFFECT_SLIDE_IN, 40);
if(GameInfo.CaseColor == 0xFF0000)
{
boxCov->SetBoxColor((GXColor) { 198, 34, 4, 255 });
}
else if(GameInfo.CaseColor >= 0)
{
u8 * Color = (u8 *) &GameInfo.CaseColor;
boxCov->SetBoxColor((GXColor) { Color[1], Color[2], Color[3], 255 });
}
gameinfoWindow.SetEffect(EFFECT_SLIDE_LEFT | EFFECT_SLIDE_IN, 100);
}
// # of players
if (GameInfo.Players > 0)
@ -370,8 +411,7 @@ int showGameInfo(char *ID)
classiccontrollerImg->SetPosition(intputX, inputY);
classiccontrollerImg->SetAlignment(0, 4);
gameinfoWindow.Append(classiccontrollerImg);
intputX += (Settings.widescreen ? classiccontrollerImg->GetWidth() * .8 : classiccontrollerImg->GetWidth())
+ 5;
intputX += (Settings.widescreen ? classiccontrollerImg->GetWidth() * .8 : classiccontrollerImg->GetWidth()) + 5;
}
if (gamecube == 1)
{
@ -760,10 +800,6 @@ int showGameInfo(char *ID)
txtWindow.Append(synopsisTxt);
txtWindow.Append(&upBtn);
txtWindow.Append(&dnBtn);
coverImg2 = new GuiImage(cover);
coverImg2->SetWidescreen(Settings.widescreen);
coverImg2->SetPosition(15, 30);
gameinfoWindow2.Append(coverImg2);
gameinfoWindow2.Append(&txtWindow);
}
@ -771,12 +807,12 @@ int showGameInfo(char *ID)
wiitdb1Txt->SetAlignment(ALIGN_LEFT, ALIGN_BOTTOM);
wiitdb1Txt->SetPosition(40, -15);
gameinfoWindow.Append(wiitdb1Txt);
gameinfoWindow.SetEffect(EFFECT_SLIDE_LEFT | EFFECT_SLIDE_IN, 100);
if(coverImg) gameinfoWindow.Append(coverImg);
HaltGui();
//mainWindow->SetState(STATE_DISABLED);
mainWindow->Append(&gameinfoWindow);
if(boxCov) mainWindow->Append(boxCov);
mainWindow->ChangeFocus(&gameinfoWindow);
ResumeGui();
@ -808,16 +844,55 @@ int showGameInfo(char *ID)
gameinfoWindow2.Remove(&nextBtn);
gameinfoWindow2.Remove(&backBtn);
gameinfoWindow2.Remove(&homeBtn);
gameinfoWindow2.Remove(&coverBtn);
gameinfoWindow2.Remove(coverImg);
gameinfoWindow2.SetVisible(false);
gameinfoWindow.SetVisible(true);
gameinfoWindow.Append(&backBtn);
gameinfoWindow.Append(&nextBtn);
gameinfoWindow.Append(&homeBtn);
gameinfoWindow.Append(&coverBtn);
gameinfoWindow.Append(coverImg);
mainWindow->Remove(&gameinfoWindow2);
ResumeGui();
page = 1;
}
}
else if(coverBtn.GetState() == STATE_CLICKED && boxCov)
{
coverBtn.ResetState();
boxCov->SetEffect(EFFECT_BOX_FLY_CENTRE, 100);
gameinfoWindow2.Remove(&nextBtn);
gameinfoWindow2.Remove(&homeBtn);
gameinfoWindow.Remove(&nextBtn);
gameinfoWindow.Remove(&homeBtn);
boxCov->SetZoomable(true);
while(backBtn.GetState() != STATE_CLICKED && homeBtn.GetState() != STATE_CLICKED)
{
usleep(100);
if (shutdown)
Sys_Shutdown();
else if (reset)
Sys_Reboot();
}
if (page == 1)
{
gameinfoWindow.Append(&nextBtn);
gameinfoWindow.Append(&homeBtn);
}
else
{
gameinfoWindow2.Append(&nextBtn);
gameinfoWindow2.Append(&homeBtn);
}
boxCov->SetZoomable(false);
backBtn.ResetState();
boxCov->SetEffect(EFFECT_BOX_FLY_BACK, 100);
}
else if (((nextBtn.GetState() == STATE_CLICKED) || (nextBtn.GetState() == STATE_HELD)) && GameInfo.Synopsis.size() > 0)
{
nextBtn.ResetState();
@ -828,12 +903,17 @@ int showGameInfo(char *ID)
gameinfoWindow.Remove(&nextBtn);
gameinfoWindow.Remove(&backBtn);
gameinfoWindow.Remove(&homeBtn);
gameinfoWindow.Remove(&coverBtn);
gameinfoWindow.Remove(wiitdb1Txt);
gameinfoWindow.Remove(coverImg);
gameinfoWindow.SetVisible(false);
gameinfoWindow2.SetVisible(true);
coverImg->SetPosition(15, 30);
gameinfoWindow2.Append(&nextBtn);
gameinfoWindow2.Append(&backBtn);
gameinfoWindow2.Append(&homeBtn);
gameinfoWindow2.Append(&coverBtn);
gameinfoWindow2.Append(wiitdb1Txt);
gameinfoWindow2.Append(coverImg);
mainWindow->Append(&gameinfoWindow2);
ResumeGui();
page = 2;
@ -844,11 +924,17 @@ int showGameInfo(char *ID)
gameinfoWindow2.Remove(&nextBtn);
gameinfoWindow2.Remove(&backBtn);
gameinfoWindow2.Remove(&homeBtn);
gameinfoWindow2.Remove(&coverBtn);
gameinfoWindow2.Remove(wiitdb1Txt);
gameinfoWindow2.Remove(coverImg);
gameinfoWindow2.SetVisible(false);
gameinfoWindow.SetVisible(true);
gameinfoWindow.Append(&backBtn);
gameinfoWindow.Append(&nextBtn);
gameinfoWindow.Append(&homeBtn);
gameinfoWindow.Append(&coverBtn);
gameinfoWindow.Append(wiitdb1Txt);
gameinfoWindow.Append(coverImg);
mainWindow->Remove(&gameinfoWindow2);
ResumeGui();
page = 1;
@ -891,13 +977,18 @@ int showGameInfo(char *ID)
}
}
HaltGui();
gameinfoWindow.SetEffect(EFFECT_SLIDE_LEFT | EFFECT_SLIDE_OUT, 100);
while (gameinfoWindow.GetEffect() > 0)
usleep(100);
if(boxCov) boxCov->SetEffect(EFFECT_SLIDE_LEFT | EFFECT_SLIDE_OUT, 60);
ResumeGui();
while (gameinfoWindow.GetEffect() > 0) usleep(100);
HaltGui();
mainWindow->Remove(&gameinfoWindow);
if(boxCov) mainWindow->Remove(boxCov);
mainWindow->SetState(STATE_DEFAULT);
delete boxCov;
delete playersImgData;
delete playersImg;
@ -927,7 +1018,6 @@ int showGameInfo(char *ID)
delete dialogBoxImg33;
delete dialogBoxImg44;
delete coverImg;
delete coverImg2;
delete classiccontrollerImgData;
delete nunchukImgData;
delete guitarImgData;

View File

@ -56,6 +56,7 @@ void CSettings::SetDefault()
{
snprintf(covers_path, sizeof(covers_path), "%simages/", ConfigPath);
snprintf(covers2d_path, sizeof(covers2d_path), "%simages/2D/", ConfigPath);
snprintf(coversFull_path, sizeof(coversFull_path), "%simages/full/", ConfigPath);
snprintf(disc_path, sizeof(disc_path), "%simages/disc/", ConfigPath);
snprintf(titlestxt_path, sizeof(titlestxt_path), "%s", ConfigPath);
snprintf(languagefiles_path, sizeof(languagefiles_path), "%slanguage/", ConfigPath);
@ -217,6 +218,7 @@ bool CSettings::Save()
fprintf(file, "parentalcontrol = %d\n ", parentalcontrol);
fprintf(file, "covers_path = %s\n ", covers_path);
fprintf(file, "covers2d_path = %s\n ", covers2d_path);
fprintf(file, "coversFull_path = %s\n ", coversFull_path);
fprintf(file, "theme_path = %s\n ", theme_path);
fprintf(file, "theme = %s\n ", theme);
fprintf(file, "disc_path = %s\n ", disc_path);
@ -515,6 +517,11 @@ bool CSettings::SetSetting(char *name, char *value)
strcpy(covers2d_path, value);
return true;
}
else if (strcmp(name, "coversFull_path") == 0)
{
strcpy(coversFull_path, value);
return true;
}
else if (strcmp(name, "theme_path") == 0)
{
strcpy(theme_path, value);

View File

@ -55,6 +55,7 @@ class CSettings
char returnTo[20];
char ConfigPath[80];
char covers_path[100];
char coversFull_path[100];
char covers2d_path[100];
char theme_path[100];
char theme[100];

View File

@ -36,6 +36,7 @@ CustomPathsSM::CustomPathsSM()
int Idx = 0;
Options->SetName(Idx++, tr("3D Cover Path"));
Options->SetName(Idx++, tr("2D Cover Path"));
Options->SetName(Idx++, tr("Full Cover Path"));
Options->SetName(Idx++, tr("Disc Artwork Path"));
Options->SetName(Idx++, tr("Theme Path"));
Options->SetName(Idx++, tr("WiiTDB Path"));
@ -62,6 +63,9 @@ void CustomPathsSM::SetOptionValues()
//! Settings: 2D Cover Path
Options->SetValue(Idx++, Settings.covers2d_path);
//! Settings: Full Cover Path
Options->SetValue(Idx++, Settings.coversFull_path);
//! Settings: Disc Artwork Path
Options->SetValue(Idx++, Settings.disc_path);
@ -122,6 +126,13 @@ int CustomPathsSM::GetMenuInternal()
ChangePath(Settings.covers2d_path, sizeof(Settings.covers2d_path));
}
//! Settings: Full Cover Path
else if (ret == ++Idx)
{
titleTxt->SetText(tr( "Full Cover Path" ));
ChangePath(Settings.coversFull_path, sizeof(Settings.coversFull_path));
}
//! Settings: Disc Artwork Path
else if (ret == ++Idx)
{

View File

@ -318,16 +318,22 @@ int GameLoadSM::GetMenuInternal()
//! Settings: Select DOL Offset from Game
else if (ret == ++Idx && GameConfig.loadalternatedol == 1)
{
GuiWindow * parentWindow = (GuiWindow *) parentElement;
if(parentWindow) parentWindow->SetState(STATE_DISABLED);
//alt dol menu for games that require more than a single alt dol
int autodol = autoSelectDolPrompt((char *) GameConfig.id);
if(autodol == 0)
{
if(parentWindow) parentWindow->SetState(STATE_DEFAULT);
return MENU_NONE; //Cancel Button pressed
}
if (autodol > 0)
{
GameConfig.alternatedolstart = autodol;
snprintf(GameConfig.alternatedolname, sizeof(GameConfig.alternatedolname), "%s <%i>", tr( "AUTO" ), autodol);
SetOptionValues();
if(parentWindow) parentWindow->SetState(STATE_DEFAULT);
return MENU_NONE;
}
@ -342,6 +348,7 @@ int GameLoadSM::GetMenuInternal()
if(GameConfig.alternatedolstart == 0)
GameConfig.loadalternatedol = 0;
if(parentWindow) parentWindow->SetState(STATE_DEFAULT);
}
//! Settings: Block IOS Reload

View File

@ -167,6 +167,8 @@ RecourceFile Resources::RecourceFiles[] =
{"unlock.png", unlock_png, unlock_png_size, NULL, 0},
{"unlock_gray.png", unlock_gray_png, unlock_gray_png_size, NULL, 0},
{"Channel_btn.png", Channel_btn_png, Channel_btn_png_size, NULL, 0},
{"boxBorder.png", boxBorder_png, boxBorder_png_size, NULL, 0},
{"nocoverFull.png", nocoverFull_png, nocoverFull_png_size, NULL, 0},
{"button_click.wav", button_click_wav, button_click_wav_size, NULL, 0},
{"button_click2.wav", button_click2_wav, button_click2_wav_size, NULL, 0},
{"button_over.wav", button_over_wav, button_over_wav_size, NULL, 0},

View File

@ -25,6 +25,7 @@ static int whichfb = 0; // Switch
static GXRModeObj *vmode; // Menu video mode
static unsigned char gp_fifo[DEFAULT_FIFO_SIZE] ATTRIBUTE_ALIGN ( 32 );
static Mtx GXmodelView2D;
static Mtx44 projection;
int screenheight;
int screenwidth;
u32 frameCount = 0;
@ -39,7 +40,6 @@ u8 * gameScreenTex2 = NULL; // a GX texture screen capture of the game (copy)
****************************************************************************/
void ResetVideo_Menu()
{
Mtx44 p;
f32 yscale;
u32 xfbHeight;
@ -65,7 +65,8 @@ void ResetVideo_Menu()
if (vmode->aa)
GX_SetPixelFmt(GX_PF_RGB565_Z16, GX_ZC_LINEAR);
else GX_SetPixelFmt(GX_PF_RGB8_Z24, GX_ZC_LINEAR);
else
GX_SetPixelFmt(GX_PF_RGB8_Z24, GX_ZC_LINEAR);
// setup the vertex descriptor
// tells the flipper to expect direct data
@ -92,10 +93,10 @@ void ResetVideo_Menu()
guMtxTransApply(GXmodelView2D, GXmodelView2D, 0.0F, 0.0F, -200.0F);
GX_LoadPosMtxImm(GXmodelView2D, GX_PNMTX0);
guOrtho(p, 0, 479, 0, 639, 0, 300);
GX_LoadProjectionMtx(p, GX_ORTHOGRAPHIC);
guOrtho(projection, 0, 479, 0, 639, 0, 300);
GX_LoadProjectionMtx(projection, GX_ORTHOGRAPHIC);
GX_SetViewport(0, 0, vmode->fbWidth, vmode->efbHeight, 0, 1);
GX_SetViewport(0.0f, 0.0f, vmode->fbWidth, vmode->efbHeight, 0.0f, 1.0f);
GX_SetBlendMode(GX_BM_BLEND, GX_BL_SRCALPHA, GX_BL_INVSRCALPHA, GX_LO_CLEAR);
GX_SetAlphaUpdate(GX_TRUE);
}
@ -211,6 +212,8 @@ void Menu_DrawImg(f32 xpos, f32 ypos, f32 zpos, f32 width, f32 height, u8 data[]
{
if (data == NULL) return;
GX_LoadProjectionMtx(projection, GX_ORTHOGRAPHIC);
GXTexObj texObj;
GX_InitTexObj(&texObj, data, width, height, GX_TF_RGBA8, GX_CLAMP, GX_CLAMP, GX_FALSE);
@ -271,6 +274,8 @@ void Menu_DrawImg(f32 xpos, f32 ypos, f32 zpos, f32 width, f32 height, u8 data[]
***************************************************************************/
void Menu_DrawRectangle(f32 x, f32 y, f32 width, f32 height, GXColor color, u8 filled)
{
GX_LoadProjectionMtx(projection, GX_ORTHOGRAPHIC);
u8 fmt;
long n;
int i;
@ -303,6 +308,8 @@ void Menu_DrawDiskCover(f32 xpos, f32 ypos, f32 zpos, u16 width, u16 height, u16
{
if (data == NULL) return;
GX_LoadProjectionMtx(projection, GX_ORTHOGRAPHIC);
GXTexObj texObj;
GX_InitTexObj(&texObj, data, width, height, GX_TF_RGBA8, GX_CLAMP, GX_CLAMP, GX_FALSE);
@ -397,6 +404,8 @@ void Menu_DrawDiskCover(f32 xpos, f32 ypos, f32 zpos, u16 width, u16 height, u16
void Menu_DrawTPLImg(f32 xpos, f32 ypos, f32 zpos, f32 width, f32 height, GXTexObj *texObj, f32 degrees, f32 scaleX,
f32 scaleY, u8 alpha, int XX1, int YY1, int XX2, int YY2, int XX3, int YY3, int XX4, int YY4)
{
GX_LoadProjectionMtx(projection, GX_ORTHOGRAPHIC);
GX_LoadTexObj(texObj, GX_TEXMAP0);
GX_InvalidateTexAll();