Skip to content

Commit dc7ea6f

Browse files
committed
Specify if metadata are UTF-8 or ANSI
for vgm we convert from UCS-2 to UTF-8, for SAP data is a subset of ASCII so UTF-8 compatible, all the others are some unspecified ANSI codepage
1 parent 811e77e commit dc7ea6f

File tree

6 files changed

+12
-3
lines changed

6 files changed

+12
-3
lines changed

gme/Gme_File.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -206,6 +206,7 @@ blargg_err_t Gme_File::track_info( track_info_t* out, int track ) const
206206
out->fade_length = -1;
207207
out->play_length = -1;
208208
out->repeat_count = -1;
209+
out->isUtf8 = 0;
209210
out->song [0] = 0;
210211

211212
out->game [0] = 0;

gme/Gme_File.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,8 @@ struct track_info_t
3939
* otherwise a default of 150000 (2.5 minutes) */
4040
long play_length;
4141

42+
long isUtf8;
43+
4244
/* empty string if not available */
4345
char system [256];
4446
char game [256];

gme/Sap_Emu.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -208,6 +208,7 @@ static void copy_sap_fields( Sap_Emu::info_t const& in, track_info_t* out )
208208
Gme_File::copy_field_( out->game, in.name );
209209
Gme_File::copy_field_( out->author, in.author );
210210
Gme_File::copy_field_( out->copyright, in.copyright );
211+
out->isUtf8 = 1;
211212
}
212213

213214
blargg_err_t Sap_Emu::track_info_( track_info_t* out, int ) const

gme/Vgm_Emu.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -106,6 +106,7 @@ static void parse_gd3( byte const* in, byte const* end, track_info_t* out )
106106
in = get_gd3_str ( in, end, out->copyright );
107107
in = get_gd3_pair( in, end, out->dumper );
108108
in = get_gd3_str ( in, end, out->comment );
109+
out->isUtf8 = 1;
109110
}
110111

111112
static int const gd3_header_size = 12;

gme/gme.cpp

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -326,7 +326,6 @@ gme_err_t gme_track_info( Music_Emu const* me, gme_info_t** out, int track )
326326
COPY( loop_length );
327327
COPY( fade_length );
328328

329-
info->i5 = -1;
330329
info->i6 = -1;
331330
info->i7 = -1;
332331
info->i8 = -1;
@@ -336,7 +335,9 @@ gme_err_t gme_track_info( Music_Emu const* me, gme_info_t** out, int track )
336335
info->i12 = -1;
337336
info->i13 = -1;
338337
info->i14 = -1;
339-
info->i15 = -1;
338+
info->i15 = -1;
339+
340+
COPY( isUtf8 );
340341

341342
info->s7 = "";
342343
info->s8 = "";

gme/gme.h

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -145,7 +145,10 @@ struct gme_info_t
145145
/* fade length in milliseconds; -1 if unknown */
146146
int fade_length;
147147

148-
int i5,i6,i7,i8,i9,i10,i11,i12,i13,i14,i15; /* reserved */
148+
/* strings encoding, 1 if UTF-8, 0 if unknown ANSI codepage */
149+
int isUtf8;
150+
151+
int i6,i7,i8,i9,i10,i11,i12,i13,i14,i15; /* reserved */
149152

150153
/* empty string ("") if not available */
151154
const char* system;

0 commit comments

Comments
 (0)