Skip to content

Commit

Permalink
Update curl and minor bug fixes
Browse files Browse the repository at this point in the history
This commit reflects the changes made as of version 2.2.5, which was
released on August 11th, 2017.  As such, curl is updated to the most
recent version at that time (7.54.0) and the resulting build should be
equivalent to the build that has been distributed.
  • Loading branch information
DTM9025 committed Jun 15, 2018
1 parent cf1e972 commit d23208a
Show file tree
Hide file tree
Showing 9 changed files with 63 additions and 24 deletions.
14 changes: 14 additions & 0 deletions Changelog.txt
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,20 @@ Changelog
NOTE: This file only lists changes to the user interface program.
Refer to the bgmlib changelog for changes to supported games and the back-end engine.

- 2017/06/04 (Version 2.2.4)
* Fix bug with Tasofro extraction not ignoring the Remove Opening Silence option.

----

- 2017/06/03 (Version 2.2.3)
* Fix parsing of references, now removing them as intended.

----

- 2017/05/29 (Version 2.2.2)
* Updated curl to fix automatic track name and comment translation downloading from Touhou Wiki

----

- 2011/05/14 (Version 2.2)
* Added an appropriate warning for custom encoders when dealing with lossy music
Expand Down
2 changes: 1 addition & 1 deletion libs/curl
Submodule curl updated 2546 files
8 changes: 4 additions & 4 deletions src/enc_vorbis.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -211,14 +211,14 @@ bool Encoder_Vorbis::Extract(TrackInfo* TI, FXString& EncFN, GameInfo* GI, Extra
if(VF.links == 1) CSA = false;

// This is necessary because seeking to 0 apparently breaks the codebooks
Start = TI->GetStart(FMT_SAMPLE, CSA ? 0 : SilRem);
Start = TI->GetStart(FMT_SAMPLE, CSA ? 0 : SilResolve());
if(!(CSA && !Start) ) ov_pcm_seek(&VF, Start);
}
else CSA = false;
}
else
{
V.In.position(TI->GetStart(FMT_BYTE, SilRem));
V.In.position(TI->GetStart(FMT_BYTE, SilResolve()));
}
}

Expand Down Expand Up @@ -285,14 +285,14 @@ bool Encoder_Vorbis::Extract(TrackInfo* TI, FXString& EncFN, GameInfo* GI, Extra

StreamLen = ov_pcm_total(&VF, Link);

EncLen = TI->GetByteLength(SilRem, LoopCnt, FadeDur);
EncLen = TI->GetByteLength(SilResolve(), LoopCnt, FadeDur);
}
else
{
BGMLib::UI_Stat_Safe("intro...");
vorbis_write_headers(V.Out, &ES.stream_out, &ES.vi, &TF->vc);

EncLen = TI->GetByteLength(SilRem, 1, fabs(FadeDur));
EncLen = TI->GetByteLength(SilResolve(), 1, fabs(FadeDur));
if(V.FadeStart < EncLen) EncLen = V.FadeStart + V.FadeBytes;

StreamLen = V.tl - ( (TI->FS != 0) ? 0 : V.ts_data);
Expand Down
8 changes: 4 additions & 4 deletions src/extract.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ bool OpenVorbisBGM(FXFile& File, OggVorbis_File& VF, GameInfo* GI, TrackInfo* TI
if(!GI->OpenBGMFile(File, TI)) return false;

if(ov_open_callbacks(&File, &VF, NULL, 0, OV_CALLBACKS_FXFILE)) return false;
ov_pcm_seek(&VF, TI->GetStart(FMT_SAMPLE, SilRem));
ov_pcm_seek(&VF, TI->GetStart(FMT_SAMPLE, SilResolve()));
return true;
}

Expand Down Expand Up @@ -156,10 +156,10 @@ Extract_Vals::Extract_Vals(TrackInfo* TI, const bool& Fmt)

void Extract_Vals::Init(TrackInfo* TI, const bool& Fmt)
{
TI->GetPos(Fmt, SilRem, &ts_ext, &tl, &te);
TI->GetPos(Fmt, SilResolve(), &ts_ext, &tl, &te);
TI->GetPos(Fmt, false, &ts_data);

Len = TI->GetByteLength(SilRem, LoopCnt, FadeDur);
Len = TI->GetByteLength(SilResolve(), LoopCnt, FadeDur);

FadeBytes = (ulong)(fabs(FadeDur) * TI->Freq * 4.0f);

Expand Down Expand Up @@ -248,7 +248,7 @@ bool Extractor::PrepareInput(TrackInfo* TI, GameInfo* GI, Extract_Vals& V)
{
if(!OpenVorbisBGM(V.In, VF, GI, TI)) return false;
}
Size = TI->GetByteLength(SilRem, 1, 0);
Size = TI->GetByteLength(SilResolve(), 1, 0);
V.d = 0;

V.Out.open(DecodeFile, FXIO::Writing);
Expand Down
9 changes: 6 additions & 3 deletions src/mainwnd.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -243,6 +243,7 @@ MainWnd::MainWnd(FXApp* App, FXIcon* Ico)
AlgBox->setNumVisible(Ext.FAs.Size());

RemoveSilence = new FXCheckButton(ParamBox, "Remove opening silence", this, MW_UPDATE_LENGTHS, CHECKBUTTON_NORMAL);
RemEnabled = RemoveSilence->isEnabled();

StartFrame = new FXVerticalFrame(OutRightFrame, LAYOUT_FILL, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0);
StartAll = new FXButton(StartFrame, "Extract all", NULL, this, MW_EXTRACT_ALL, BUTTON_NORMAL | LAYOUT_FILL);
Expand Down Expand Up @@ -279,7 +280,7 @@ void MainWnd::create()

StreamerFront::Inst().Init(id());

RemoveSilence->handle(this, FXSEL(SEL_COMMAND, SilRem ? ID_CHECK : ID_UNCHECK), (void*)SilRem);
RemoveSilence->handle(this, FXSEL(SEL_COMMAND, SilResolve() ? ID_CHECK : ID_UNCHECK), (void*)SilResolve());
TrackPlay->handle(this, FXSEL(SEL_COMMAND, Play ? ID_CHECK : ID_UNCHECK), (void*)Play);
handle(this, FXSEL(SEL_COMMAND, MW_TOGGLE_PLAY), (void*)Play);

Expand Down Expand Up @@ -416,6 +417,7 @@ void MainWnd::LoadGame(GameInfo* GI)
Comment->setText("");
GameDir->Field->setText("");
RemoveSilence->enable();
RemEnabled = RemoveSilence->isEnabled();
handle(this, FXSEL(SEL_COMMAND, MW_CHANGE_ACTION_STATE), false);
TrackView->fitColumnsToContents(0, TrackView->getNumColumns());
}
Expand Down Expand Up @@ -454,6 +456,7 @@ void MainWnd::LoadGame(GameInfo* GI)

if((GI->CryptKind && GI->Vorbis) || !GI->SilenceScan) RemoveSilence->disable();
else RemoveSilence->enable();
RemEnabled = RemoveSilence->isEnabled();

Str.RequestTrackSwitch(CurTrack);
if(Play) Str.Play();
Expand Down Expand Up @@ -663,7 +666,7 @@ long MainWnd::onCmdLengths(FXObject* Sender, FXSelector Message, void* ptr)
continue;
}

Len = TI->GetByteLength(SilRem, LoopCnt, FadeDur);
Len = TI->GetByteLength(SilResolve(), LoopCnt, FadeDur);

TrackView->setItemText(Row, 2, TI->LengthString(Len));

Expand Down Expand Up @@ -733,7 +736,7 @@ long MainWnd::onPlayStat(FXObject* Sender, FXSelector Message, void* ptr)
TrackInfo* TI = Str.CurTrack();
if(Play && ActiveGame && TI)
{
Len = TI->GetByteLength(SilRem, 1, 0);
Len = TI->GetByteLength(SilResolve(), 1, 0);
Cur = Str.Pos();

Stat.format("Playing: %s %s // %s, %.0f Hz // %s / %s", TI->GetNumber(), TI->Name[Lang], ActiveGame->Vorbis ? "Vorbis" : "PCM", TI->Freq, TI->LengthString(Cur), TI->LengthString(Len));
Expand Down
4 changes: 3 additions & 1 deletion src/musicroom.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,8 @@ MainWnd* MWBack; // Back end GUI class
bool Play; // Play selected track?
ushort FadeAlgID = 0; // Fade algorithm
bool SilRem = true; // Remove opening silence?
bool RemEnabled = true;
bool SilResolve() { return SilRem && RemEnabled; }
int Volume = 100;
// ---

Expand Down Expand Up @@ -63,7 +65,7 @@ FXString OutPath; // Output directory
// String Constants
FXString PrgName = "Music Room Interface";
FXString WebPage = "http://bit.ly/musicroom_interface";
const FXString PrgVer = "v2.2";
const FXString PrgVer = "v2.2.5";
const FXString NoGame = "(no game loaded)";
FXString CfgFile = "musicroom.cfg";
FXString LGDFile = "gamedirs.cfg";
Expand Down
4 changes: 3 additions & 1 deletion src/musicroom.h
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// Music Room Interface
// --------------------
// "©" Nmlgc, 2010-2011
// "©" Nmlgc, 2010-2011

#ifndef MUSICROOM_MUSICROOM_H
#define MUSICROOM_MUSICROOM_H
Expand Down Expand Up @@ -85,8 +85,10 @@ extern MainWndFront* MW;
extern bool Play; // Play selected track?
extern ushort FadeAlgID; // Fade algorithm
extern bool SilRem; // Remove opening silence?
extern bool RemEnabled; // Remove Silience Button enabled?
extern int Volume;
extern FXFont* Monospace;
extern bool SilResolve();
// ---

// Game
Expand Down
6 changes: 3 additions & 3 deletions src/stream.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,7 @@ bool Streamer::SwitchTrack_WAV(TrackInfo* NewTrack, FXString& NewFN)

if(!ActiveGame->OpenBGMFile(CurFile, NewTrack)) return false;
}
Pos = NewTrack->GetStart(FMT_BYTE, SilRem);
Pos = NewTrack->GetStart(FMT_BYTE, SilResolve());
CurFile.position(Pos);

SB->SetFrequency(NewTrack->Freq);
Expand All @@ -171,7 +171,7 @@ bool Streamer::SwitchTrack_OGG(TrackInfo* NewTrack, FXString& NewFN)
}
else if(Track && CurFNHash == NewFNHash)
{
ov_pcm_seek(&SF, NewTrack->GetStart(FMT_SAMPLE, SilRem));
ov_pcm_seek(&SF, NewTrack->GetStart(FMT_SAMPLE, SilResolve()));
}
else
{
Expand Down Expand Up @@ -327,7 +327,7 @@ ulong StreamerFront::Pos()

ulong Ret = Str.Pos;
if(ActiveGame->Vorbis) Ret <<= 2;
if(Str.Track->FS == 0) Ret -= Str.Track->GetStart(FMT_BYTE, SilRem);
if(Str.Track->FS == 0) Ret -= Str.Track->GetStart(FMT_BYTE, SilResolve());
return Ret;
}
// ---------
32 changes: 25 additions & 7 deletions src/wikiupdate.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
// --------------------
// wikiupdate.cpp - Touhou Wiki Track Info Updating
// --------------------
// "©" Nmlgc, 2010-2011
// "©" Nmlgc, 2010-2011

#include <bgmlib/platform.h>

Expand Down Expand Up @@ -160,13 +160,11 @@ FXuint AskForUpdate(TrackInfo* TI, const FXString& Type, FXString* Old, FXString
{
if(New->empty() || *Ret == UPDATE_NOALL) return *Ret;

// Remove line breaks for comparison
// Normalize new-lines.
FXString o = *Old, n = *New;
o.simplify();
n.simplify();
removeSub(o, ' ');
removeSub(n, ' ');
if(o == n) return *Ret;
o.substitute("\r\n", "\n");
n.substitute("\r\n", "\n");
if(o == n) return *Ret;

FXString Msg;
if(*Ret != UPDATE_YESALL && !Old->empty())
Expand Down Expand Up @@ -225,6 +223,12 @@ static TrackInfo* Eval_MusicRoom(GameInfo* GI, FXString& WD, FXuint* MsgRet)
SrcVal.format("%s%d", Wiki_Comment[LANG_JP], s);
SrcVal = TemplateElm_Comment(WD, SrcVal);

// Because some comments skip the first number.
if(SrcVal.empty() && s == 1)
{
s++;
continue;
}
if(SrcVal.empty()) break;
NC = &Afterword.Add()->Data;

Expand Down Expand Up @@ -451,7 +455,21 @@ bool Update(GameInfo* GI, FXString& WikiURL)
Page.substitute("&gt;", ">");
Page.substitute("&lt;", "<");

// Remove other references
{
FXRex regexp_ref;
if(!regexp_ref.parse("<ref>.*?</ref>", regexp_mode))
{
while (regexp_ref.match(Page, &s, &t, FXRex::Forward, 1, s))
{
Page.erase(s, t-s);
}
}
}

// Too less time for a proper fix right now
// TODO: Investigate linebreak behavior in Touhou Wiki
Page.substitute("<br />\n", "\n"); // Hopefully this renders stuff correctly.
Page.substitute("<br />", "\n");

// Magical Astronomy...
Expand Down

0 comments on commit d23208a

Please sign in to comment.