mirror of
https://github.com/hrydgard/ppsspp.git
synced 2026-10-01 14:58:14 +00:00
Fix some checks around translation.
This commit is contained in:
1 parent
67aa951fec
commit
68be93467e
4 files changed
+8
-7
No files matched your search
@@ -117,6 +117,8 @@ public:
|
||||
std::shared_ptr<I18NCategory> GetCategoryByName(const char *name);
|
||||
|
||||
const char *T(I18NCat category, const char *key, const char *def = nullptr) {
|
||||
if (category == I18NCat::NONE)
|
||||
return def ? def : key;
|
||||
return cats_[(size_t)category]->T(key, def);
|
||||
}
|
||||
|
||||
@@ -140,4 +142,3 @@ std::shared_ptr<I18NCategory> GetI18NCategory(I18NCat cat);
|
||||
inline const char *T(I18NCat category, const char *key, const char *def = nullptr) {
|
||||
return g_i18nrepo.T(category, key, def);
|
||||
}
|
||||
|
||||
@@ -115,12 +115,11 @@ void PopupMultiChoice::Update() {
|
||||
void PopupMultiChoice::UpdateText() {
|
||||
if (!choices_)
|
||||
return;
|
||||
auto category = GetI18NCategory(category_);
|
||||
// Clamp the value to be safe.
|
||||
if (*value_ < minVal_ || *value_ > minVal_ + numChoices_ - 1) {
|
||||
int index = *value_ - minVal_;
|
||||
if (index < 0 || index >= numChoices_) {
|
||||
valueText_ = "(invalid choice)"; // Shouldn't happen. Should be no need to translate this.
|
||||
} else {
|
||||
valueText_ = category ? category->T(choices_[*value_ - minVal_]) : choices_[*value_ - minVal_];
|
||||
valueText_ = T(category_, choices_[index]);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -205,13 +205,14 @@ public:
|
||||
: AbstractChoiceWithValueDisplay(text, layoutParams), value_(value), choices_(choices), minVal_(minVal), numChoices_(numChoices),
|
||||
category_(category), screenManager_(screenManager) {
|
||||
if (choices) {
|
||||
// If choices is nullptr, we're being called from PopupMultiChoiceDynamic where value doesn't yet point to anything valid.
|
||||
if (*value >= numChoices + minVal)
|
||||
*value = numChoices + minVal - 1;
|
||||
if (*value < minVal)
|
||||
*value = minVal;
|
||||
UpdateText();
|
||||
}
|
||||
OnClick.Handle(this, &PopupMultiChoice::HandleClick);
|
||||
UpdateText();
|
||||
}
|
||||
|
||||
void Update() override;
|
||||
|
||||
@@ -250,7 +250,7 @@ void GenerateDepalShaderFloat(ShaderWriter &writer, const DepalConfig &config) {
|
||||
case GE_FORMAT_5551:
|
||||
if (config.textureFormat == GE_TFMT_CLUT8 && mask == 0xFF && shift == 0) {
|
||||
// Follow the intent here, and ignore g (and let's not round unnecessarily).
|
||||
sprintf(lookupMethod, "floor(floor(index.a) * 128.0 + index.b * 64.0)"); // we just skip A.
|
||||
sprintf(lookupMethod, "floor(floor(index.a) * 128.0 + index.b * 64.0)");
|
||||
index_multiplier = 1.0f / 256.0f;
|
||||
// SOCOM case. #16210
|
||||
} else if ((mask & (mask + 1)) == 0 && shift < 16) {
|
||||
|
||||
Reference in new issue
Block a user