Make distinction for multiple disc.

This commit is contained in:
shenweip 2013-11-26 01:14:11 +08:00 committed by Henrik Rydgård
parent 3855773203
commit f772cba43d
3 changed files with 18 additions and 3 deletions

View File

@ -209,6 +209,8 @@ public:
info_->title = info_->paramSFO.GetValueString("TITLE"); info_->title = info_->paramSFO.GetValueString("TITLE");
info_->id = info_->paramSFO.GetValueString("DISC_ID"); info_->id = info_->paramSFO.GetValueString("DISC_ID");
info_->id_version = info_->paramSFO.GetValueString("DISC_ID") + "_" + info_->paramSFO.GetValueString("DISC_VERSION"); info_->id_version = info_->paramSFO.GetValueString("DISC_ID") + "_" + info_->paramSFO.GetValueString("DISC_VERSION");
info_->disc_total = info_->paramSFO.GetValueInt("DISC_TOTAL");
info_->disc_number = info_->paramSFO.GetValueInt("DISC_NUMBER");
info_->paramSFOLoaded = true; info_->paramSFOLoaded = true;
} }
@ -276,6 +278,8 @@ public:
info_->title = info_->paramSFO.GetValueString("TITLE"); info_->title = info_->paramSFO.GetValueString("TITLE");
info_->id = info_->paramSFO.GetValueString("DISC_ID"); info_->id = info_->paramSFO.GetValueString("DISC_ID");
info_->id_version = info_->paramSFO.GetValueString("DISC_ID") + "_" + info_->paramSFO.GetValueString("DISC_VERSION"); info_->id_version = info_->paramSFO.GetValueString("DISC_ID") + "_" + info_->paramSFO.GetValueString("DISC_VERSION");
info_->disc_total = info_->paramSFO.GetValueInt("DISC_TOTAL");
info_->disc_number = info_->paramSFO.GetValueInt("DISC_NUMBER");
info_->paramSFOLoaded = true; info_->paramSFOLoaded = true;
} }
@ -308,6 +312,8 @@ public:
info_->title = info_->paramSFO.GetValueString("TITLE"); info_->title = info_->paramSFO.GetValueString("TITLE");
info_->id = info_->paramSFO.GetValueString("DISC_ID"); info_->id = info_->paramSFO.GetValueString("DISC_ID");
info_->id_version = info_->paramSFO.GetValueString("DISC_ID") + "_" + info_->paramSFO.GetValueString("DISC_VERSION"); info_->id_version = info_->paramSFO.GetValueString("DISC_ID") + "_" + info_->paramSFO.GetValueString("DISC_VERSION");
info_->disc_total = info_->paramSFO.GetValueInt("DISC_TOTAL");
info_->disc_number = info_->paramSFO.GetValueInt("DISC_NUMBER");
info_->paramSFOLoaded = true; info_->paramSFOLoaded = true;
} else { } else {

View File

@ -59,6 +59,8 @@ public:
std::string title; // for easy access, also available in paramSFO. std::string title; // for easy access, also available in paramSFO.
std::string id; std::string id;
std::string id_version; std::string id_version;
int disc_total;
int disc_number;
IdentifiedFileType fileType; IdentifiedFileType fileType;
ParamSFOData paramSFO; ParamSFOData paramSFO;
bool paramSFOLoaded; bool paramSFOLoaded;

View File

@ -186,6 +186,12 @@ void GameButton::Draw(UIContext &dc) {
dc.Draw()->Flush(); dc.Draw()->Flush();
} }
char discNumInfo[8];
if (ginfo->disc_total > 1)
sprintf(discNumInfo, "-DISC%d",ginfo->disc_number);
else
sprintf(discNumInfo, "");
dc.Draw()->Flush(); dc.Draw()->Flush();
dc.RebindTexture(); dc.RebindTexture();
dc.SetFontStyle(dc.theme->uiFont); dc.SetFontStyle(dc.theme->uiFont);
@ -193,8 +199,9 @@ void GameButton::Draw(UIContext &dc) {
float tw, th; float tw, th;
dc.Draw()->Flush(); dc.Draw()->Flush();
dc.PushScissor(bounds_); dc.PushScissor(bounds_);
std::string title = ginfo->title + discNumInfo;
dc.MeasureText(dc.GetFontStyle(), ginfo->title.c_str(), &tw, &th, 0); dc.MeasureText(dc.GetFontStyle(), title.c_str(), &tw, &th, 0);
int availableWidth = bounds_.w - 150; int availableWidth = bounds_.w - 150;
float sineWidth = std::max(0.0f, (tw - availableWidth)) / 2.0f; float sineWidth = std::max(0.0f, (tw - availableWidth)) / 2.0f;
@ -207,7 +214,7 @@ void GameButton::Draw(UIContext &dc) {
tb.w = bounds_.w - 150; tb.w = bounds_.w - 150;
dc.PushScissor(tb); dc.PushScissor(tb);
} }
dc.DrawText(ginfo->title.c_str(), bounds_.x + tx, bounds_.centerY(), style.fgColor, ALIGN_VCENTER); dc.DrawText(title.c_str(), bounds_.x + tx, bounds_.centerY(), style.fgColor, ALIGN_VCENTER);
if (availableWidth < tw) { if (availableWidth < tw) {
dc.PopScissor(); dc.PopScissor();
} }
@ -216,7 +223,7 @@ void GameButton::Draw(UIContext &dc) {
} else if (!texture) { } else if (!texture) {
dc.Draw()->Flush(); dc.Draw()->Flush();
dc.PushScissor(bounds_); dc.PushScissor(bounds_);
dc.DrawText(ginfo->title.c_str(), bounds_.x + 4, bounds_.centerY(), style.fgColor, ALIGN_VCENTER); dc.DrawText((ginfo->title + discNumInfo).c_str(), bounds_.x + 4, bounds_.centerY(), style.fgColor, ALIGN_VCENTER);
dc.Draw()->Flush(); dc.Draw()->Flush();
dc.PopScissor(); dc.PopScissor();
} else { } else {