diff --git a/HBC/META.XML b/HBC/META.XML index 9132690a..48420c27 100644 --- a/HBC/META.XML +++ b/HBC/META.XML @@ -2,8 +2,8 @@ USB Loader GX USB Loader GX Team - 2.0 r1073 - 201102141852 + 2.0 r1074 + 201102211941 Loads games from USB-devices 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. diff --git a/gui.pnproj b/gui.pnproj index 8dfb6431..a4fb6f18 100644 --- a/gui.pnproj +++ b/gui.pnproj @@ -1 +1 @@ - \ No newline at end of file + \ No newline at end of file diff --git a/source/BoxCover/BoxCover.cpp b/source/BoxCover/BoxCover.cpp index 2650394c..76b6c2d6 100644 --- a/source/BoxCover/BoxCover.cpp +++ b/source/BoxCover/BoxCover.cpp @@ -23,6 +23,7 @@ ***************************************************************************/ #include "BoxCover.hpp" #include "BoxMesh.hpp" +#include "settings/CSettings.h" #include "themes/CTheme.h" extern GuiImageData * pointer[4]; @@ -47,12 +48,13 @@ BoxCover::BoxCover(GuiImageData * img, bool flat) PosZ = -27.f; 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}; + guVector camera = (guVector) {0.0F, 0.0F, 0.0F}; + guVector up = (guVector) {0.0F, 1.0F, 0.0F}; + guVector look = (guVector) {0.0F, 0.0F, -1.0F}; boxColor = (GXColor) {233, 233, 233, 255}; guLookAt(view, &camera, &up, &look); + guPerspective(projection, 8, 640.f/480.f, 1.0f, 300.0F); //! Remove me later for(int i = 0; i < 4; ++i) @@ -110,7 +112,7 @@ void BoxCover::WiiPADControl(GuiTrigger *t) else moveChan = -1; } - else if((t->wpad.btns_h & WPAD_BUTTON_A) && moveChan == t->chan && t->wpad.ir.valid) + else if((t->wpad.btns_h & WPAD_BUTTON_A) && moveChan == t->chan && t->wpad.ir.valid && !effects) { movePosX = (t->wpad.ir.x-moveStartPosX) * fabs(PosZ)/3400.f; movePosY = (moveStartPosY-t->wpad.ir.y) * fabs(PosZ)/3400.f; @@ -194,8 +196,6 @@ void BoxCover::Draw() { u8 BoxAlpha = (int) (alpha+angleDyn) & 0xFF; - Mtx44 projection; - guPerspective(projection, 8, (f32)screenwidth/(f32)screenheight, 1.0f, 300.0F); GX_LoadProjectionMtx(projection, GX_PERSPECTIVE); GX_SetVtxDesc(GX_VA_POS, GX_INDEX8); @@ -215,7 +215,8 @@ void BoxCover::Draw() guMtxRotAxisDeg(modelView, &cubeAxis, RotZ-Animation); guMtxConcat(modelView3, modelView2, modelView2); guMtxConcat(modelView2, modelView, modelView); - //guMtxScaleApply(modelView, modelView, BoxScale, BoxScale, BoxScale); + if(Settings.widescreen) + guMtxScaleApply(modelView, modelView, Settings.WSFactor, 1.0f, 1.0f); guMtxTransApply(modelView, modelView, PosX+xoffsetDyn/680.0f+movePosX, PosY+yoffsetDyn/680.0f+movePosY, PosZ); guMtxConcat(view,modelView,modelView); @@ -317,14 +318,14 @@ void BoxCover::UpdateEffects() if(effects & EFFECT_BOX_FLY_CENTRE) { - if(PosX > 0.01f) - PosX -= effectAmount/1200.0f; - if(PosY > 0.01f) - PosY -= effectAmount/1200.0f; - if(PosX < -0.01f) - PosX += effectAmount/1200.0f; - if(PosY < -0.01f) - PosY += effectAmount/1200.0f; + if(PosX > 0.1f) + PosX -= effectAmount/1200.f; + if(PosY > 0.1f) + PosY -= effectAmount/1200.f; + if(PosX < -0.1f) + PosX += effectAmount/1200.f; + if(PosY < -0.1f) + PosY += effectAmount/1200.f; movePosX = 0.0f; movePosY = 0.0f; @@ -342,13 +343,13 @@ void BoxCover::UpdateEffects() else if(effects & EFFECT_BOX_FLY_BACK) { if(PosX > PosXOrig+0.1f) - PosX -= effectAmount/1200.0f; + PosX -= effectAmount/1200.f; if(PosY > PosYOrig+0.1f) - PosY -= effectAmount/1200.0f; + PosY -= effectAmount/1200.f; if(PosX < PosXOrig-0.1f) - PosX += effectAmount/1200.0f; + PosX += effectAmount/1200.f; if(PosY < PosYOrig-0.1f) - PosY += effectAmount/1200.0f; + PosY += effectAmount/1200.f; PosZ -= 0.4f; RotY -= effectAmount/4.9f; diff --git a/source/BoxCover/BoxCover.hpp b/source/BoxCover/BoxCover.hpp index f16cf5b5..63c21382 100644 --- a/source/BoxCover/BoxCover.hpp +++ b/source/BoxCover/BoxCover.hpp @@ -69,7 +69,7 @@ class BoxCover : public GuiImage int moveChan; bool flatCover; bool Zoomable; - guVector camera, up, look; + Mtx44 projection; GuiImageData boxBorder; GuiImageData *defaultBox; GuiImageData *NormalPointers[4]; @@ -79,8 +79,6 @@ class BoxCover : public GuiImage GXTexObj boxBorderTex; GXTexObj defaultBoxTex; GXColor boxColor; - - }; #endif diff --git a/source/FileOperations/DirList.cpp b/source/FileOperations/DirList.cpp index 8bc7d1ff..831d998a 100644 --- a/source/FileOperations/DirList.cpp +++ b/source/FileOperations/DirList.cpp @@ -81,7 +81,7 @@ bool DirList::LoadPath(std::string &folderpath, const char *filter, u32 flags) if(!filename || !st) { delete [] filename; - delete filename; + delete st; closedir(dir); return false; } diff --git a/source/FreeTypeGX.cpp b/source/FreeTypeGX.cpp index ff250197..093e639e 100644 --- a/source/FreeTypeGX.cpp +++ b/source/FreeTypeGX.cpp @@ -377,15 +377,12 @@ uint16_t FreeTypeGX::drawText(int16_t x, int16_t y, int16_t z, const wchar_t *te { if (ftKerningEnabled && i > 0) { - FT_Get_Kerning(ftFace, fontData[pixelSize][text[i - 1]].glyphIndex, glyphData->glyphIndex, - FT_KERNING_DEFAULT, &pairDelta); + FT_Get_Kerning(ftFace, fontData[pixelSize][text[i - 1]].glyphIndex, glyphData->glyphIndex, FT_KERNING_DEFAULT, &pairDelta); x_pos += pairDelta.x >> 6; } - GX_InitTexObj(&glyphTexture, glyphData->glyphDataTexture, glyphData->textureWidth, - glyphData->textureHeight, GX_TF_IA4, GX_CLAMP, GX_CLAMP, GX_FALSE); - copyTextureToFramebuffer(&glyphTexture, glyphData->textureWidth, glyphData->textureHeight, x_pos - + glyphData->renderOffsetX + x_offset, y - glyphData->renderOffsetY + y_offset, z, color); + GX_InitTexObj(&glyphTexture, glyphData->glyphDataTexture, glyphData->textureWidth, glyphData->textureHeight, GX_TF_IA4, GX_CLAMP, GX_CLAMP, GX_FALSE); + copyTextureToFramebuffer(&glyphTexture, glyphData->textureWidth, glyphData->textureHeight, x_pos + glyphData->renderOffsetX + x_offset, y - glyphData->renderOffsetY + y_offset, z, color); x_pos += glyphData->glyphAdvanceX; ++printed; diff --git a/source/libwiigui/Text.cpp b/source/libwiigui/Text.cpp index 31e1df09..153785fe 100644 --- a/source/libwiigui/Text.cpp +++ b/source/libwiigui/Text.cpp @@ -1,3 +1,4 @@ +#include "settings/CSettings.h" #include "Text.hpp" Text::Text(const char * t, int s, GXColor c) : @@ -312,7 +313,7 @@ void Text::Draw() GXColor c = color; c.a = this->GetAlpha(); - int newSize = size * GetScale(); + int newSize = size * GetScale() * Settings.FontScaleFactor; if (newSize != currentSize) { diff --git a/source/libwiigui/gui.h b/source/libwiigui/gui.h index 1643f2e8..8856a6c6 100644 --- a/source/libwiigui/gui.h +++ b/source/libwiigui/gui.h @@ -216,10 +216,10 @@ class GuiElement int GetMaxX(); //!Gets the current width of the element. Does not currently consider the scale //!\return width - int GetWidth(); + virtual int GetWidth(); //!Gets the height of the element. Does not currently consider the scale //!\return height - int GetHeight(); + virtual int GetHeight(); //!Sets the size (width/height) of the element //!\param w Width of element //!\param h Height of element @@ -662,6 +662,8 @@ class GuiText: public GuiElement void SetFont(FreeTypeGX *f); //!Get the original text as char virtual const wchar_t * GetText(); + //!Overload for GetWidth() + int GetWidth() { return GetTextWidth(); } //!Get the Horizontal Size of Text int GetTextWidth(); int GetTextWidth(int ind); diff --git a/source/libwiigui/gui_diskcover.cpp b/source/libwiigui/gui_diskcover.cpp index c68cb51a..bbeb19bd 100644 --- a/source/libwiigui/gui_diskcover.cpp +++ b/source/libwiigui/gui_diskcover.cpp @@ -1,4 +1,5 @@ #include "gui_diskcover.h" +#include "settings/CSettings.h" GuiDiskCover::GuiDiskCover() { @@ -75,11 +76,11 @@ void GuiDiskCover::Draw() LOCK( this ); if (!image || !this->IsVisible()) return; float currScale = this->GetScale(); - // Menu_DrawDiskCoverShadow(this->GetLeft(), this->GetTop(), 190, width, height, 40, image, imageangle, deg_beta, widescreen ? currScale*0.8 : currScale, currScale, this->GetAlpha(), true); + Menu_DrawDiskCover(this->GetLeft(), this->GetTop(), PosZ, width, height, Distance, image, imageangle, deg_beta, - widescreen ? currScale * 0.8 : currScale, currScale, 64, true); + widescreen ? currScale * Settings.WSFactor : currScale, currScale, 64, true); Menu_DrawDiskCover(this->GetLeft(), this->GetTop(), PosZ, width, height, Distance, image, imageangle, deg_beta, - widescreen ? currScale * 0.8 : currScale, currScale, this->GetAlpha(), false); + widescreen ? currScale * Settings.WSFactor : currScale, currScale, this->GetAlpha(), false); if (eff_step) { diff --git a/source/libwiigui/gui_gamebrowser.cpp b/source/libwiigui/gui_gamebrowser.cpp index ec3ee586..a2580a56 100644 --- a/source/libwiigui/gui_gamebrowser.cpp +++ b/source/libwiigui/gui_gamebrowser.cpp @@ -248,21 +248,6 @@ int GuiGameBrowser::GetClickedOption() return found; } -int GuiGameBrowser::GetSelectedOption() -{ - int found = -1; - for (int i = 0; i < pagesize; i++) - { - if (game[i]->GetState() == STATE_SELECTED) - { - game[i]->SetState(STATE_SELECTED); - found = gameIndex[i]; - break; - } - } - return found; -} - /**************************************************************************** * FindMenuItem * diff --git a/source/libwiigui/gui_gamebrowser.h b/source/libwiigui/gui_gamebrowser.h index f685033a..772b1999 100644 --- a/source/libwiigui/gui_gamebrowser.h +++ b/source/libwiigui/gui_gamebrowser.h @@ -11,7 +11,7 @@ class GuiGameBrowser: public GuiElement ~GuiGameBrowser(); int FindMenuItem(int c, int d); int GetClickedOption(); - int GetSelectedOption(); + int GetSelectedOption() { return listOffset+selectedItem; } void ResetState(); void SetFocus(int f); void Draw(); diff --git a/source/libwiigui/gui_image.cpp b/source/libwiigui/gui_image.cpp index 964d6b7d..aadd3299 100644 --- a/source/libwiigui/gui_image.cpp +++ b/source/libwiigui/gui_image.cpp @@ -9,6 +9,7 @@ ***************************************************************************/ #include "gui.h" +#include "settings/CSettings.h" /** * Constructor for the GuiImage class. */ @@ -440,7 +441,7 @@ void GuiImage::Draw() { for (int i = 0; i < tile; i++) Menu_DrawImg(currLeft + width * i, this->GetTop(), zoffset, width, height, image, imageangle, - widescreen ? currScale * 0.80 : currScale, currScale, this->GetAlpha(), xx1, yy1, xx2, yy2, xx3, + widescreen ? currScale * Settings.WSFactor : currScale, currScale, this->GetAlpha(), xx1, yy1, xx2, yy2, xx3, yy3, xx4, yy4); } else @@ -448,7 +449,7 @@ void GuiImage::Draw() // temporary (maybe), used to correct offset for scaled images if (scale != 1) currLeft = currLeft - width / 2 + (width * scale) / 2; - Menu_DrawImg(currLeft, this->GetTop(), zoffset, width, height, image, imageangle, widescreen ? currScale * 0.80 + Menu_DrawImg(currLeft, this->GetTop(), zoffset, width, height, image, imageangle, widescreen ? currScale * Settings.WSFactor : currScale, currScale, this->GetAlpha(), xx1, yy1, xx2, yy2, xx3, yy3, xx4, yy4); } diff --git a/source/libwiigui/gui_text.cpp b/source/libwiigui/gui_text.cpp index bd3bbcdf..2148e23f 100644 --- a/source/libwiigui/gui_text.cpp +++ b/source/libwiigui/gui_text.cpp @@ -10,6 +10,7 @@ #include "gui.h" #include "wstring.hpp" +#include "settings/CSettings.h" #define MAX_LINES_TO_DRAW 9 @@ -18,8 +19,7 @@ static int presetMaxWidth = 0; static int presetAlignmentHor = 0; static int presetAlignmentVert = 0; static u16 presetStyle = 0; -static GXColor presetColor = ( GXColor ) -{ 255, 255, 255, 255}; +static GXColor presetColor = (GXColor) {255, 255, 255, 255}; #define TEXT_SCROLL_DELAY 5 #define TEXT_SCROLL_INITIAL_DELAY 8 @@ -527,7 +527,7 @@ void GuiText::Draw() GXColor c = color; c.a = GetAlpha(); - int newSize = size * GetScale(); + int newSize = size * GetScale() * Settings.FontScaleFactor; if (newSize != currentSize) { @@ -540,18 +540,19 @@ void GuiText::Draw() { if (wrapMode == DOTTED) // text dotted { - if (textDyn.size() == 0) MakeDottedText(); + if (textDyn.size() == 0) + MakeDottedText(); - if (textDyn.size() > 0) (font ? font : fontSystem)->drawText(this->GetLeft(), this->GetTop(), 0, - textDyn[textDyn.size() - 1], currentSize, c, style); + if (textDyn.size() > 0) + (font ? font : fontSystem)->drawText(this->GetLeft(), this->GetTop(), 0, textDyn[textDyn.size() - 1], currentSize, c, style); } else if (wrapMode == SCROLL_HORIZONTAL) { ScrollText(); - if (textDyn.size() > 0) (font ? font : fontSystem)->drawText(this->GetLeft(), this->GetTop(), 0, - textDyn[textDyn.size() - 1], currentSize, c, style); + if (textDyn.size() > 0) + (font ? font : fontSystem)->drawText(this->GetLeft(), this->GetTop(), 0, textDyn[textDyn.size() - 1], currentSize, c, style); } else if (wrapMode == WRAP) { @@ -563,8 +564,7 @@ void GuiText::Draw() for (u32 i = 0; i < textDyn.size(); i++) { - (font ? font : fontSystem)->drawText(this->GetLeft(), this->GetTop() + voffset + i * lineheight, 0, - textDyn[i], currentSize, c, style); + (font ? font : fontSystem)->drawText(this->GetLeft(), this->GetTop() + voffset + i * lineheight, 0, textDyn[i], currentSize, c, style); } } } diff --git a/source/menu.cpp b/source/menu.cpp index 4c64d180..b73d01f9 100644 --- a/source/menu.cpp +++ b/source/menu.cpp @@ -116,7 +116,7 @@ static void * UpdateGUI(void *arg) userInput[i].wpad.ir.y - pointer[i]->GetHeight()/2, 9900.0f, pointer[i]->GetWidth(), pointer[i]->GetHeight(), pointer[i]->GetImage(), userInput[i].wpad.ir.angle, - Settings.widescreen ? 0.8f : 1.f, 1.f, 255, 0, 0, 0, 0, 0, 0, 0, 0); + Settings.widescreen ? Settings.WSFactor : 1.f, 1.f, 255, 0, 0, 0, 0, 0, 0, 0, 0); } } diff --git a/source/prompts/ProgressWindow.cpp b/source/prompts/ProgressWindow.cpp index 2483c30e..10d2f9df 100644 --- a/source/prompts/ProgressWindow.cpp +++ b/source/prompts/ProgressWindow.cpp @@ -181,9 +181,9 @@ static void UpdateProgressValues(GuiImage *progressbarImg, GuiText *prTxt, GuiTe prTxt->SetTextf("%.2f", progressPercent); if (Settings.widescreen && Settings.wsprompt) - progressbarImg->SetSkew(0, 0, static_cast (progressbarImg->GetWidth() * progressPercent * 0.8) + progressbarImg->SetSkew(0, 0, static_cast (progressbarImg->GetWidth() * progressPercent * Settings.WSFactor) - progressbarImg->GetWidth(), 0, static_cast (progressbarImg->GetWidth() * progressPercent - * 0.8) - progressbarImg->GetWidth(), 0, 0, 0); + * Settings.WSFactor) - progressbarImg->GetWidth(), 0, 0, 0); else progressbarImg->SetSkew(0, 0, static_cast (progressbarImg->GetWidth() * progressPercent) - progressbarImg->GetWidth(), 0, static_cast (progressbarImg->GetWidth() * progressPercent) diff --git a/source/prompts/PromptWindows.cpp b/source/prompts/PromptWindows.cpp index bcc83835..b64cee44 100644 --- a/source/prompts/PromptWindows.cpp +++ b/source/prompts/PromptWindows.cpp @@ -240,11 +240,10 @@ void WindowCredits() txt[i]->SetPosition(0, 12); i++; + char SvnRev[30]; #ifdef FULLCHANNEL - char SvnRev[30]; - snprintf( SvnRev, sizeof( SvnRev ), "Rev%sc IOS%u (Rev %u)", GetRev(), IOS_GetVersion(), IOS_GetRevision() ); + snprintf(SvnRev, sizeof(SvnRev), "Rev%sc IOS%u (Rev %u)", GetRev(), IOS_GetVersion(), IOS_GetRevision()); #else - char SvnRev[30]; snprintf(SvnRev, sizeof(SvnRev), "Rev%s IOS%u (Rev %u)", GetRev(), IOS_GetVersion(), IOS_GetRevision()); #endif @@ -362,35 +361,35 @@ void WindowCredits() sprintf(text, "Waninkoko, Kwiirk & Hermes %s", tr( "for the USB Loader source" )); txt[i] = new GuiText(text); txt[i]->SetAlignment(ALIGN_LEFT, ALIGN_TOP); - txt[i]->SetPosition(60, y); + txt[i]->SetPosition(10, y); i++; y += 20; sprintf(text, "Tantric %s", tr( "for his awesome tool LibWiiGui" )); txt[i] = new GuiText(text); txt[i]->SetAlignment(ALIGN_LEFT, ALIGN_TOP); - txt[i]->SetPosition(60, y); + txt[i]->SetPosition(10, y); i++; y += 20; sprintf(text, "Fishears/Nuke %s", tr( "for Ocarina" )); txt[i] = new GuiText(text); txt[i]->SetAlignment(ALIGN_LEFT, ALIGN_TOP); - txt[i]->SetPosition(60, y); + txt[i]->SetPosition(10, y); i++; y += 20; sprintf(text, "WiiPower %s", tr( "for diverse patches" )); txt[i] = new GuiText(text); txt[i]->SetAlignment(ALIGN_LEFT, ALIGN_TOP); - txt[i]->SetPosition(60, y); + txt[i]->SetPosition(10, y); i++; y += 20; sprintf(text, "Oggzee %s", tr( "for FAT/NTFS support" )); txt[i] = new GuiText(text); txt[i]->SetAlignment(ALIGN_LEFT, ALIGN_TOP); - txt[i]->SetPosition(60, y); + txt[i]->SetPosition(10, y); i++; y += 20; diff --git a/source/prompts/gameinfo.cpp b/source/prompts/gameinfo.cpp index 652dfee4..735104f9 100644 --- a/source/prompts/gameinfo.cpp +++ b/source/prompts/gameinfo.cpp @@ -396,7 +396,7 @@ static int InternalShowGameInfo(char *ID) playersImg->SetPosition(intputX, inputY); playersImg->SetAlignment(0, 4); InfoWindow.Append(playersImg); - intputX += (Settings.widescreen ? playersImg->GetWidth() * .8 : playersImg->GetWidth()) + 5; + intputX += (Settings.widescreen ? playersImg->GetWidth() * Settings.WSFactor : playersImg->GetWidth()) + 5; } //draw the input types for this game @@ -407,7 +407,7 @@ static int InternalShowGameInfo(char *ID) motionplusImg->SetPosition(intputX, inputY); motionplusImg->SetAlignment(0, 4); InfoWindow.Append(motionplusImg); - intputX += (Settings.widescreen ? motionplusImg->GetWidth() * .8 : motionplusImg->GetWidth()) + 5; + intputX += (Settings.widescreen ? motionplusImg->GetWidth() * Settings.WSFactor : motionplusImg->GetWidth()) + 5; } if (nunchuk == 1) { @@ -416,7 +416,7 @@ static int InternalShowGameInfo(char *ID) nunchukImg->SetPosition(intputX, inputY); nunchukImg->SetAlignment(0, 4); InfoWindow.Append(nunchukImg); - intputX += (Settings.widescreen ? nunchukImg->GetWidth() * .8 : nunchukImg->GetWidth()) + 5; + intputX += (Settings.widescreen ? nunchukImg->GetWidth() * Settings.WSFactor : nunchukImg->GetWidth()) + 5; } if (classiccontroller == 1) { @@ -425,7 +425,7 @@ static int InternalShowGameInfo(char *ID) classiccontrollerImg->SetPosition(intputX, inputY); classiccontrollerImg->SetAlignment(0, 4); InfoWindow.Append(classiccontrollerImg); - intputX += (Settings.widescreen ? classiccontrollerImg->GetWidth() * .8 : classiccontrollerImg->GetWidth()) + 5; + intputX += (Settings.widescreen ? classiccontrollerImg->GetWidth() * Settings.WSFactor : classiccontrollerImg->GetWidth()) + 5; } if (gamecube == 1) { @@ -434,7 +434,7 @@ static int InternalShowGameInfo(char *ID) gcImg->SetPosition(intputX, inputY); gcImg->SetAlignment(0, 4); InfoWindow.Append(gcImg); - intputX += (Settings.widescreen ? gcImg->GetWidth() * .8 : gcImg->GetWidth()) + 5; + intputX += (Settings.widescreen ? gcImg->GetWidth() * Settings.WSFactor : gcImg->GetWidth()) + 5; } if (wheel == 1) { @@ -443,7 +443,7 @@ static int InternalShowGameInfo(char *ID) wheelImg->SetPosition(intputX, inputY); wheelImg->SetAlignment(0, 4); InfoWindow.Append(wheelImg); - intputX += (Settings.widescreen ? wheelImg->GetWidth() * .8 : wheelImg->GetWidth()) + 5; + intputX += (Settings.widescreen ? wheelImg->GetWidth() * Settings.WSFactor : wheelImg->GetWidth()) + 5; } if (guitar == 1) { @@ -452,7 +452,7 @@ static int InternalShowGameInfo(char *ID) guitarImg->SetPosition(intputX, inputY); guitarImg->SetAlignment(0, 4); InfoWindow.Append(guitarImg); - intputX += (Settings.widescreen ? guitarImg->GetWidth() * .8 : guitarImg->GetWidth()) + 5; + intputX += (Settings.widescreen ? guitarImg->GetWidth() * Settings.WSFactor : guitarImg->GetWidth()) + 5; } if (drums == 1) { @@ -461,7 +461,7 @@ static int InternalShowGameInfo(char *ID) drumsImg->SetPosition(intputX, inputY); drumsImg->SetAlignment(0, 4); InfoWindow.Append(drumsImg); - intputX += (Settings.widescreen ? drumsImg->GetWidth() * .8 : drumsImg->GetWidth()) + 5; + intputX += (Settings.widescreen ? drumsImg->GetWidth() * Settings.WSFactor : drumsImg->GetWidth()) + 5; } if (microphone == 1) { @@ -470,7 +470,7 @@ static int InternalShowGameInfo(char *ID) microphoneImg->SetPosition(intputX, inputY); microphoneImg->SetAlignment(0, 4); InfoWindow.Append(microphoneImg); - intputX += (Settings.widescreen ? microphoneImg->GetWidth() * .8 : microphoneImg->GetWidth()) + 5; + intputX += (Settings.widescreen ? microphoneImg->GetWidth() * Settings.WSFactor : microphoneImg->GetWidth()) + 5; } if (zapper == 1) { @@ -479,7 +479,7 @@ static int InternalShowGameInfo(char *ID) zapperImg->SetPosition(intputX, inputY); zapperImg->SetAlignment(0, 4); InfoWindow.Append(zapperImg); - intputX += (Settings.widescreen ? zapperImg->GetWidth() * .8 : zapperImg->GetWidth()) + 5; + intputX += (Settings.widescreen ? zapperImg->GetWidth() * Settings.WSFactor : zapperImg->GetWidth()) + 5; } if (wiispeak == 1) { @@ -488,7 +488,7 @@ static int InternalShowGameInfo(char *ID) wiispeakImg->SetPosition(intputX, inputY); wiispeakImg->SetAlignment(0, 4); InfoWindow.Append(wiispeakImg); - intputX += (Settings.widescreen ? wiispeakImg->GetWidth() * .8 : wiispeakImg->GetWidth()) + 5; + intputX += (Settings.widescreen ? wiispeakImg->GetWidth() * Settings.WSFactor : wiispeakImg->GetWidth()) + 5; } if (nintendods == 1) { @@ -497,7 +497,7 @@ static int InternalShowGameInfo(char *ID) nintendodsImg->SetPosition(intputX, inputY); nintendodsImg->SetAlignment(0, 4); InfoWindow.Append(nintendodsImg); - intputX += (Settings.widescreen ? nintendodsImg->GetWidth() * .8 : nintendodsImg->GetWidth()) + 5; + intputX += (Settings.widescreen ? nintendodsImg->GetWidth() * Settings.WSFactor : nintendodsImg->GetWidth()) + 5; } if (dancepad == 1) { @@ -506,7 +506,7 @@ static int InternalShowGameInfo(char *ID) dancepadImg->SetPosition(intputX, inputY); dancepadImg->SetAlignment(0, 4); InfoWindow.Append(dancepadImg); - intputX += (Settings.widescreen ? dancepadImg->GetWidth() * .8 : dancepadImg->GetWidth()) + 5; + intputX += (Settings.widescreen ? dancepadImg->GetWidth() * Settings.WSFactor : dancepadImg->GetWidth()) + 5; } if (balanceboard == 1) { @@ -515,7 +515,7 @@ static int InternalShowGameInfo(char *ID) balanceboardImg->SetPosition(intputX, inputY); balanceboardImg->SetAlignment(0, 4); InfoWindow.Append(balanceboardImg); - intputX += (Settings.widescreen ? balanceboardImg->GetWidth() * .8 : balanceboardImg->GetWidth()) + 5; + intputX += (Settings.widescreen ? balanceboardImg->GetWidth() * Settings.WSFactor : balanceboardImg->GetWidth()) + 5; } // # online players @@ -547,7 +547,7 @@ static int InternalShowGameInfo(char *ID) wifiplayersImg->SetPosition(intputX, inputY); wifiplayersImg->SetAlignment(0, 4); InfoWindow.Append(wifiplayersImg); - intputX += (Settings.widescreen ? wifiplayersImg->GetWidth() * .8 : wifiplayersImg->GetWidth()) + 5; + intputX += (Settings.widescreen ? wifiplayersImg->GetWidth() * Settings.WSFactor : wifiplayersImg->GetWidth()) + 5; } // ratings @@ -614,7 +614,7 @@ static int InternalShowGameInfo(char *ID) ratingImg->SetPosition(-25, inputY); ratingImg->SetAlignment(1, 4); InfoWindow.Append(ratingImg); - intputX += (Settings.widescreen ? ratingImg->GetWidth() * .8 : ratingImg->GetWidth()) + 5; + intputX += (Settings.widescreen ? ratingImg->GetWidth() * Settings.WSFactor : ratingImg->GetWidth()) + 5; } // title @@ -680,7 +680,7 @@ static int InternalShowGameInfo(char *ID) char linebuf[300]; snprintf(linebuf, sizeof(linebuf), "%s : %s%i", tr( "Released" ), linebuf2, year); releasedTxt = new GuiText(linebuf, 16, ( GXColor ) {0, 0, 0, 255}); - if (releasedTxt->GetWidth() > 300) newline = 2; + if (releasedTxt->GetTextWidth() > 300) newline = 2; releasedTxt->SetAlignment(ALIGN_RIGHT, ALIGN_TOP); releasedTxt->SetPosition(-17, 12 + indexy); indexy += (20 * newline); @@ -693,7 +693,7 @@ static int InternalShowGameInfo(char *ID) { snprintf(linebuf2, sizeof(linebuf2), "%s %s", tr( "Published by" ), GameInfo.Publisher.c_str()); publisherTxt = new GuiText(linebuf2, 16, ( GXColor ) {0, 0, 0, 255}); - if (publisherTxt->GetWidth() > 250) newline = 2; + if (publisherTxt->GetTextWidth() > 250) newline = 2; publisherTxt->SetMaxWidth(250, WRAP); publisherTxt->SetAlignment(ALIGN_RIGHT, ALIGN_TOP); publisherTxt->SetPosition(-17, 12 + indexy); @@ -707,7 +707,7 @@ static int InternalShowGameInfo(char *ID) { snprintf(linebuf2, sizeof(linebuf2), "%s %s", tr( "Developed by" ), GameInfo.Developer.c_str()); developerTxt = new GuiText(linebuf2, 16, ( GXColor ) {0, 0, 0, 255}); - if (developerTxt->GetWidth() > 250) newline = 2; + if (developerTxt->GetTextWidth() > 250) newline = 2; developerTxt->SetMaxWidth(250, WRAP); developerTxt->SetAlignment(ALIGN_RIGHT, ALIGN_TOP); developerTxt->SetPosition(-17, 12 + indexy); diff --git a/source/settings/CSettings.cpp b/source/settings/CSettings.cpp index be017878..f4467f36 100644 --- a/source/settings/CSettings.cpp +++ b/source/settings/CSettings.cpp @@ -116,6 +116,8 @@ void CSettings::SetDefault() MultiplePartitions = OFF; USBPort = 0; CacheTitles = ON; + WSFactor = 0.8f; //actually should be 0.75 for real widescreen + FontScaleFactor = 1.0f; } bool CSettings::Load() @@ -259,6 +261,8 @@ bool CSettings::Save() fprintf(file, "MultiplePartitions = %d\n ", MultiplePartitions); fprintf(file, "USBPort = %d\n ", USBPort); fprintf(file, "CacheTitles = %d\n ", CacheTitles); + fprintf(file, "WSFactor = %0.3f\n ", WSFactor); + fprintf(file, "FontScaleFactor = %0.3f\n ", FontScaleFactor); fclose(file); return true; @@ -516,6 +520,16 @@ bool CSettings::SetSetting(char *name, char *value) InstallPartitions = strtoul(value, 0, 16); return true; } + else if (strcmp(name, "WSFactor") == 0) + { + WSFactor = atof(value); + return true; + } + else if (strcmp(name, "FontScaleFactor") == 0) + { + FontScaleFactor = atof(value); + return true; + } else if (strcmp(name, "ParentalBlocks") == 0) { ParentalBlocks = strtoul(value, 0, 16); diff --git a/source/settings/CSettings.h b/source/settings/CSettings.h index 38645174..1cd3c982 100644 --- a/source/settings/CSettings.h +++ b/source/settings/CSettings.h @@ -115,6 +115,8 @@ class CSettings short CacheTitles; u32 InstallPartitions; u32 ParentalBlocks; + f32 WSFactor; + f32 FontScaleFactor; protected: bool ValidVersion(FILE * file); bool SetSetting(char *name, char *value); diff --git a/source/settings/menus/GUISettingsMenu.cpp b/source/settings/menus/GUISettingsMenu.cpp index 73b9fd60..6d7b112e 100644 --- a/source/settings/menus/GUISettingsMenu.cpp +++ b/source/settings/menus/GUISettingsMenu.cpp @@ -111,6 +111,8 @@ GuiSettingsMenu::GuiSettingsMenu() Options->SetName(Idx++, "%s", tr( "Tooltips" )); Options->SetName(Idx++, "%s", tr( "Flip-X" )); Options->SetName(Idx++, "%s", tr( "Prompts Buttons" )); + Options->SetName(Idx++, "%s", tr( "Widescreen Factor" )); + Options->SetName(Idx++, "%s", tr( "Font Scale Factor" )); Options->SetName(Idx++, "%s", tr( "Keyboard" )); Options->SetName(Idx++, "%s", tr( "Disc Artwork Download" )); Options->SetName(Idx++, "%s", tr( "Wiilight" )); @@ -168,6 +170,12 @@ void GuiSettingsMenu::SetOptionValues() //! Settings: Prompts Buttons Options->SetValue(Idx++, "%s", tr( PromptButtonsText[Settings.wsprompt] )); + //! Settings: Widescreen Factor + Options->SetValue(Idx++, "%0.3f", Settings.WSFactor); + + //! Settings: Font Scale Factor + Options->SetValue(Idx++, "%0.3f", Settings.FontScaleFactor); + //! Settings: Keyboard Options->SetValue(Idx++, "%s", KeyboardText[Settings.keyset]); @@ -281,6 +289,26 @@ int GuiSettingsMenu::GetMenuInternal() if (++Settings.wsprompt >= MAX_ON_OFF) Settings.wsprompt = 0; } + //! Settings: Widescreen Factor + else if (ret == ++Idx) + { + char entrie[20]; + snprintf(entrie, sizeof(entrie), "%0.3f", Settings.WSFactor); + int ret = OnScreenKeyboard(entrie, sizeof(entrie), 0); + if(ret) + Settings.WSFactor = atof(entrie); + } + + //! Settings: Font Scale Factor + else if (ret == ++Idx) + { + char entrie[20]; + snprintf(entrie, sizeof(entrie), "%0.3f", Settings.FontScaleFactor); + int ret = OnScreenKeyboard(entrie, sizeof(entrie), 0); + if(ret) + Settings.FontScaleFactor = atof(entrie); + } + //! Settings: Keyboard else if (ret == ++Idx) { diff --git a/source/usbloader/wbfs/wbfs_fat.cpp b/source/usbloader/wbfs/wbfs_fat.cpp index 76259417..8f0a8f9e 100644 --- a/source/usbloader/wbfs/wbfs_fat.cpp +++ b/source/usbloader/wbfs/wbfs_fat.cpp @@ -423,12 +423,16 @@ s32 Wbfs_Fat::GetHeadersCount() // usb:/wbfs/TITLE[GAMEID]/GAMEID.wbfs lay_b = 1; } - else if (fname[6] == '_' && is_gameid((char*) id)) + else if (fname[6] == '_') { // usb:/wbfs/GAMEID_TITLE/GAMEID.wbfs - lay_a = 1; memcpy(id, fname, 6); - snprintf(fname_title, sizeof(fname_title), &fname[7]); + + if(is_gameid((char*) id)) + { + lay_a = 1; + snprintf(fname_title, sizeof(fname_title), &fname[7]); + } } if (!lay_a && !lay_b) continue;