Skip to content

Commit

Permalink
Fix handling of utf16 title strings in ROMInfoDialog
Browse files Browse the repository at this point in the history
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.)
  • Loading branch information
RayyanAnsari committed Sep 2, 2022
1 parent c3bd1d2 commit 61de500
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 60 deletions.
12 changes: 6 additions & 6 deletions src/frontend/qt_sdl/ROMInfoDialog.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -75,12 +75,12 @@ ROMInfoDialog::ROMInfoDialog(QWidget* parent) : QDialog(parent), ui(new Ui::ROMI

ui->iconTitle->setText(QString::fromUtf16(NDSCart::Banner.EnglishTitle));

ui->japaneseTitle->setText(QString::fromUtf16(NDSCart::Banner.JapaneseTitle, 128));
ui->englishTitle->setText(QString::fromUtf16(NDSCart::Banner.EnglishTitle, 128));
ui->frenchTitle->setText(QString::fromUtf16(NDSCart::Banner.FrenchTitle, 128));
ui->germanTitle->setText(QString::fromUtf16(NDSCart::Banner.GermanTitle, 128));
ui->italianTitle->setText(QString::fromUtf16(NDSCart::Banner.ItalianTitle, 128));
ui->spanishTitle->setText(QString::fromUtf16(NDSCart::Banner.SpanishTitle, 128));
ui->japaneseTitle->setText(QString::fromUtf16(NDSCart::Banner.JapaneseTitle));
ui->englishTitle->setText(QString::fromUtf16(NDSCart::Banner.EnglishTitle));
ui->frenchTitle->setText(QString::fromUtf16(NDSCart::Banner.FrenchTitle));
ui->germanTitle->setText(QString::fromUtf16(NDSCart::Banner.GermanTitle));
ui->italianTitle->setText(QString::fromUtf16(NDSCart::Banner.ItalianTitle));
ui->spanishTitle->setText(QString::fromUtf16(NDSCart::Banner.SpanishTitle));

if (NDSCart::Banner.Version > 1)
ui->chineseTitle->setText(QString::fromUtf16(NDSCart::Banner.ChineseTitle));
Expand Down
65 changes: 11 additions & 54 deletions src/frontend/qt_sdl/ROMInfoDialog.ui
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@
<rect>
<x>0</x>
<y>0</y>
<width>427</width>
<height>434</height>
<width>559</width>
<height>532</height>
</rect>
</property>
<property name="sizePolicy">
Expand All @@ -22,12 +22,6 @@
<layout class="QGridLayout" name="gridLayout">
<item row="2" column="0">
<widget class="QGroupBox" name="titles">
<property name="sizePolicy">
<sizepolicy hsizetype="MinimumExpanding" vsizetype="MinimumExpanding">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="title">
<string>Titles</string>
</property>
Expand Down Expand Up @@ -350,12 +344,6 @@
</item>
<item row="3" column="1">
<widget class="QGroupBox" name="filesystem">
<property name="sizePolicy">
<sizepolicy hsizetype="MinimumExpanding" vsizetype="MinimumExpanding">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="title">
<string>Filesystem</string>
</property>
Expand Down Expand Up @@ -441,12 +429,6 @@
</item>
<item row="3" column="0">
<widget class="QGroupBox" name="generalInfo">
<property name="sizePolicy">
<sizepolicy hsizetype="MinimumExpanding" vsizetype="MinimumExpanding">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="title">
<string>General info</string>
</property>
Expand Down Expand Up @@ -668,7 +650,7 @@
</layout>
</widget>
</item>
<item row="0" column="3">
<item row="0" column="2">
<widget class="QGroupBox" name="dsiIconBox">
<property name="sizePolicy">
<sizepolicy hsizetype="Minimum" vsizetype="Minimum">
Expand Down Expand Up @@ -742,43 +724,11 @@
</layout>
</widget>
</item>
<item row="0" column="0">
<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">
<item row="0" column="3">
<spacer name="horizontalSpacer_3">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</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>
</item>
<item row="1" column="1">
Expand All @@ -788,6 +738,13 @@
</property>
</widget>
</item>
<item row="0" column="0">
<spacer name="horizontalSpacer">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
</spacer>
</item>
</layout>
</widget>
</item>
Expand Down

0 comments on commit 61de500

Please sign in to comment.