@@ -13,14 +13,15 @@ extern "C" {
13
13
#include " decoder/sseq2mid.h"
14
14
}
15
15
16
- bool SdatXI_FindSdat (const std::string &filepath, std::vector<SdatX> &sdats) {
16
+ std::vector<SdatX> SdatXI_FindSdat (const std::string &filepath) {
17
+ std::vector<SdatX> sdats;
17
18
uint8_t sdatMagic[] = {' S' ,' D' ,' A' ,' T' ,0xFF ,0xFE ,0x00 ,0x01 };
18
19
19
20
std::ifstream ifs (filepath, std::ios::binary | std::ios::ate);
20
21
uint32_t mlength = ifs.tellg ();
21
22
22
23
if (!ifs.good () || mlength < 0x400 )
23
- return false ;
24
+ return sdats ;
24
25
25
26
MemFile mfile = MemFile (filepath, mlength);
26
27
@@ -53,22 +54,23 @@ bool SdatXI_FindSdat(const std::string &filepath, std::vector<SdatX> &sdats) {
53
54
}
54
55
55
56
printf (" Total SDATs found: %d\n " , sdats.size ());
56
- return true ;
57
+ return sdats ;
57
58
}
58
59
59
- bool SdatX::Init (const std::string &filepath, std::vector<SdatX> &sdats, bool &isNds) {
60
+ std::vector<SdatX> SdatX::Init (const std::string &filepath, bool &isNds) {
61
+ std::vector<SdatX> sdats;
60
62
if (!File::Exists (filepath)) {
61
63
error (" Failed to open file.\n " );
62
- return false ;
64
+ return sdats ;
63
65
}
64
66
65
67
if (!SDAT::Verify (filepath)) {
66
68
isNds = true ;
67
- SdatXI_FindSdat (filepath, sdats );
69
+ sdats = SdatXI_FindSdat (filepath);
68
70
} else
69
71
sdats.emplace_back (filepath);
70
72
71
- return true ;
73
+ return sdats ;
72
74
}
73
75
74
76
SdatX::SdatX (const std::string &filepath) : m_Filepath(filepath)
@@ -206,9 +208,9 @@ bool SdatX::Extract()
206
208
int ret = 0 ;
207
209
if ((ret = SWAREX_init (&swarx, swar.Offset , swar.Length ))) {
208
210
if (ret == SWARE_BAD)
209
- printf (" SWAR open error : Did not pass validation.\n May be corrupted?\n " );
211
+ error (" SWAR: Did not pass validation.\n May be corrupted?\n " );
210
212
if (ret == SWARE_EMPTY)
211
- printf (" SWAR open error : No files found to extract.\n " );
213
+ warning (" SWAR: No files found to extract.\n " );
212
214
213
215
SWAREX_exit (&swarx);
214
216
fs::current_path (" .." );
@@ -301,7 +303,7 @@ bool SdatX::Extract()
301
303
printf (" Total written files:\n " );
302
304
printf (" SSEQ:%d\n " , numSSEQ);
303
305
printf (" SBNK:%d\n " , numSBNK);
304
- printf (" %s:%d\n " , bDecodeFile ? " SWAV" : " SWAR" , numSWAR);
306
+ printf (" %s:%d\n " , ( bDecodeFile || bGetSwav) ? " SWAV" : " SWAR" , numSWAR);
305
307
printf (" STRM:%d\n " , numSTRM);
306
308
307
309
return true ;
0 commit comments