Fix handling of utf16 title strings in ROMInfoDialog

Title strings should be null-terminated.
Read the string up until this point instead of reading the full 128 characters.
(Also fix the .ui file of ROMInfoDialog to prevent it from being too wide.)
This commit is contained in:
Rayyan Ansari 2022-09-02 11:54:47 +01:00
parent c3bd1d2e83
commit 61de50069b
2 changed files with 17 additions and 60 deletions

View File

@ -75,12 +75,12 @@ ROMInfoDialog::ROMInfoDialog(QWidget* parent) : QDialog(parent), ui(new Ui::ROMI
ui->iconTitle->setText(QString::fromUtf16(NDSCart::Banner.EnglishTitle)); ui->iconTitle->setText(QString::fromUtf16(NDSCart::Banner.EnglishTitle));
ui->japaneseTitle->setText(QString::fromUtf16(NDSCart::Banner.JapaneseTitle, 128)); ui->japaneseTitle->setText(QString::fromUtf16(NDSCart::Banner.JapaneseTitle));
ui->englishTitle->setText(QString::fromUtf16(NDSCart::Banner.EnglishTitle, 128)); ui->englishTitle->setText(QString::fromUtf16(NDSCart::Banner.EnglishTitle));
ui->frenchTitle->setText(QString::fromUtf16(NDSCart::Banner.FrenchTitle, 128)); ui->frenchTitle->setText(QString::fromUtf16(NDSCart::Banner.FrenchTitle));
ui->germanTitle->setText(QString::fromUtf16(NDSCart::Banner.GermanTitle, 128)); ui->germanTitle->setText(QString::fromUtf16(NDSCart::Banner.GermanTitle));
ui->italianTitle->setText(QString::fromUtf16(NDSCart::Banner.ItalianTitle, 128)); ui->italianTitle->setText(QString::fromUtf16(NDSCart::Banner.ItalianTitle));
ui->spanishTitle->setText(QString::fromUtf16(NDSCart::Banner.SpanishTitle, 128)); ui->spanishTitle->setText(QString::fromUtf16(NDSCart::Banner.SpanishTitle));
if (NDSCart::Banner.Version > 1) if (NDSCart::Banner.Version > 1)
ui->chineseTitle->setText(QString::fromUtf16(NDSCart::Banner.ChineseTitle)); ui->chineseTitle->setText(QString::fromUtf16(NDSCart::Banner.ChineseTitle));

View File

@ -6,8 +6,8 @@
<rect> <rect>
<x>0</x> <x>0</x>
<y>0</y> <y>0</y>
<width>427</width> <width>559</width>
<height>434</height> <height>532</height>
</rect> </rect>
</property> </property>
<property name="sizePolicy"> <property name="sizePolicy">
@ -22,12 +22,6 @@
<layout class="QGridLayout" name="gridLayout"> <layout class="QGridLayout" name="gridLayout">
<item row="2" column="0"> <item row="2" column="0">
<widget class="QGroupBox" name="titles"> <widget class="QGroupBox" name="titles">
<property name="sizePolicy">
<sizepolicy hsizetype="MinimumExpanding" vsizetype="MinimumExpanding">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="title"> <property name="title">
<string>Titles</string> <string>Titles</string>
</property> </property>
@ -350,12 +344,6 @@
</item> </item>
<item row="3" column="1"> <item row="3" column="1">
<widget class="QGroupBox" name="filesystem"> <widget class="QGroupBox" name="filesystem">
<property name="sizePolicy">
<sizepolicy hsizetype="MinimumExpanding" vsizetype="MinimumExpanding">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="title"> <property name="title">
<string>Filesystem</string> <string>Filesystem</string>
</property> </property>
@ -441,12 +429,6 @@
</item> </item>
<item row="3" column="0"> <item row="3" column="0">
<widget class="QGroupBox" name="generalInfo"> <widget class="QGroupBox" name="generalInfo">
<property name="sizePolicy">
<sizepolicy hsizetype="MinimumExpanding" vsizetype="MinimumExpanding">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="title"> <property name="title">
<string>General info</string> <string>General info</string>
</property> </property>
@ -668,7 +650,7 @@
</layout> </layout>
</widget> </widget>
</item> </item>
<item row="0" column="3"> <item row="0" column="2">
<widget class="QGroupBox" name="dsiIconBox"> <widget class="QGroupBox" name="dsiIconBox">
<property name="sizePolicy"> <property name="sizePolicy">
<sizepolicy hsizetype="Minimum" vsizetype="Minimum"> <sizepolicy hsizetype="Minimum" vsizetype="Minimum">
@ -742,43 +724,11 @@
</layout> </layout>
</widget> </widget>
</item> </item>
<item row="0" column="0"> <item row="0" column="3">
<spacer name="horizontalSpacer">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>55</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item row="0" column="4">
<spacer name="horizontalSpacer_3"> <spacer name="horizontalSpacer_3">
<property name="orientation"> <property name="orientation">
<enum>Qt::Horizontal</enum> <enum>Qt::Horizontal</enum>
</property> </property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item row="0" column="2">
<spacer name="horizontalSpacer_2">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer> </spacer>
</item> </item>
<item row="1" column="1"> <item row="1" column="1">
@ -788,6 +738,13 @@
</property> </property>
</widget> </widget>
</item> </item>
<item row="0" column="0">
<spacer name="horizontalSpacer">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
</spacer>
</item>
</layout> </layout>
</widget> </widget>
</item> </item>