Index: winamp-musepack/trunk/mpc_player.cpp
===================================================================
--- winamp-musepack/trunk/mpc_player.cpp	(revision 253)
+++ winamp-musepack/trunk/mpc_player.cpp	(revision 254)
@@ -29,7 +29,35 @@
 #include <mpc/minimax.h>
 
-#include <taglib/tag.h>
-#include <taglib/tfile.h>
-
+#include <tag.h>
+#include <tfile.h>
+
+const char* mpc_player::GenreList [NO_GENRES] = {
+    "", "Blues", "Classic Rock", "Country", "Dance", "Disco", "Funk",
+    "Grunge", "Hip-Hop", "Jazz", "Metal", "New Age", "Oldies",
+    "Other", "Pop", "R&B", "Rap", "Reggae", "Rock",
+    "Techno", "Industrial", "Alternative", "Ska", "Death Metal", "Pranks",
+    "Soundtrack", "Euro-Techno", "Ambient", "Trip-Hop", "Vocal", "Jazz+Funk",
+    "Fusion", "Trance", "Classical", "Instrumental", "Acid", "House",
+    "Game", "Sound Clip", "Gospel", "Noise", "AlternRock", "Bass",
+    "Soul", "Punk", "Space", "Meditative", "Instrumental Pop", "Instrumental Rock",
+    "Ethnic", "Gothic", "Darkwave", "Techno-Industrial", "Electronic", "Pop-Folk",
+    "Eurodance", "Dream", "Southern Rock", "Comedy", "Cult", "Gangsta",
+    "Top 40", "Christian Rap", "Pop/Funk", "Jungle", "Native American", "Cabaret",
+    "New Wave", "Psychadelic", "Rave", "Showtunes", "Trailer", "Lo-Fi",
+    "Tribal", "Acid Punk", "Acid Jazz", "Polka", "Retro", "Musical",
+    "Rock & Roll", "Hard Rock", "Folk", "Folk/Rock", "National Folk", "Swing",
+    "Fast-Fusion", "Bebob", "Latin", "Revival", "Celtic", "Bluegrass", "Avantgarde",
+    "Gothic Rock", "Progressive Rock", "Psychedelic Rock", "Symphonic Rock", "Slow Rock", "Big Band",
+    "Chorus", "Easy Listening", "Acoustic", "Humour", "Speech", "Chanson",
+    "Opera", "Chamber Music", "Sonata", "Symphony", "Booty Bass", "Primus",
+    "Po""rn Groove", "Satire", "Slow Jam", "Club", "Tango", "Samba",
+    "Folklore", "Ballad", "Power Ballad", "Rhythmic Soul", "Freestyle", "Duet",
+    "Punk Rock", "Drum Solo", "A capella", "Euro-House", "Dance Hall",
+    "Goa", "Drum & Bass", "Club House", "Ha""rd""co""re", "Terror",
+    "Indie", "BritPop", "NegerPunk", "Polsk Punk", "Beat",
+    "Christian Gangsta", "Heavy Metal", "Black Metal", "Crossover", "Contemporary C",
+    "Christian Rock", "Merengue", "Salsa", "Thrash Metal", "Anime", "JPop",
+    "SynthPop",
+};
 
 mpc_player::mpc_player(In_Module * in_mod)
@@ -58,4 +86,7 @@
 	wait_event = 0;
 	tag_file = 0;
+	
+	TagLib::FileRef fileRef;
+	fileRef.file()->useWinAnsiCP(true);
 }
 
@@ -189,8 +220,6 @@
 	if (length_in_ms) *length_in_ms = getLength();
 	if (title) {
-		if(tag_file == 0) {
+		if (tag_file == 0)
 			tag_file = new TagLib::FileRef(lastfn, false);
-			(tag_file->file())->useWinAnsiCP(true);
-		}
 
 		if (tag_file->isNull() || !tag_file->tag()) {
@@ -201,10 +230,4 @@
 			TagLib::Tag *tag = tag_file->tag();
 			sprintf(title, "%s - %s", tag->artist().toCString(), tag->title().toCString());
-			//tag->artist()
-			//tag->album()
-			//tag->year()
-			//tag->comment()
-			//tag->track()
-			//tag->genre()
 		}
 	}
@@ -281,18 +304,24 @@
 		TagLib::Tag *tag = tag_file->tag();
 
-		//tag->setTitle(wch);
-		//tag->setArtist(wch);
-		//tag->setAlbum(wch);
-
-		//TagLib::String year(wch);
-		//tag->setYear(year.toInt());
-
-		//TagLib::String track(wch);
-		//tag->setTrack(track.toInt());
-
-		//tag->setGenre(wch);
-		//tag->setComment(wch);
-
-		tag_file->save(); // FIXME : make all crash
+		WCHAR buf[2048];
+
+		GetDlgItemTextW(hDlg, IDC_TITLE, buf, 2048);
+		tag->setTitle(buf);
+		GetDlgItemTextW(hDlg, IDC_ARTIST, buf, 2048);
+		tag->setArtist(buf);
+		GetDlgItemTextW(hDlg, IDC_ALBUM, buf, 2048);
+		tag->setAlbum(buf);
+		GetDlgItemTextW(hDlg, IDC_YEAR, buf, 2048);
+		TagLib::String year(buf);
+		tag->setYear(year.toInt());
+		GetDlgItemTextW(hDlg, IDC_TRACK, buf, 2048);
+		TagLib::String track(buf);
+		tag->setTrack(track.toInt());
+		GetDlgItemTextW(hDlg, IDC_GENRE, buf, 2048);
+		tag->setGenre(buf);
+		GetDlgItemTextW(hDlg, IDC_COMMENT, buf, 2048);
+		tag->setComment(buf);
+
+		tag_file->save();
 	}
 }
@@ -324,8 +353,8 @@
 	SetDlgItemText(hDlg, IDC_STREAM_INFO, tmp.str().c_str());
 
-	if(tag_file == 0) {
+	SetDlgItemText(hDlg, IDC_FILE, lastfn);
+
+	if (tag_file == 0)
 		tag_file = new TagLib::FileRef(lastfn, false);
-		(tag_file->file())->useWinAnsiCP(true);
-	}
 
 	if (!tag_file->isNull() && tag_file->tag()) {
@@ -350,4 +379,8 @@
 		SetDlgItemTextW(hDlg, IDC_COMMENT, buf);
 	}
+
+	HWND hGenre = GetDlgItem ( hDlg, IDC_GENRE );
+	for ( int n = 0; n < NO_GENRES; n++ )
+        SendMessage ( hGenre, CB_ADDSTRING, 0, (LONG)(LPSTR)GenreList[n] );
 }
 
@@ -358,5 +391,5 @@
 	{
 	case WM_INITDIALOG:
-		SetWindowLong(hDlg, DWL_USER, lParam);
+		SetWindowLongPtr(hDlg, DWLP_USER, lParam);
 		((mpc_player *) lParam)->initDlg(hDlg);
 		return TRUE;
@@ -367,8 +400,7 @@
 			return TRUE;
 		} else if (LOWORD(wParam) == IDC_RELOAD) {
-			// FIXME : this will not work on X64
-			((mpc_player*)GetWindowLong(hDlg, DWL_USER))->initDlg(hDlg);
+			((mpc_player*)GetWindowLongPtr(hDlg, DWLP_USER))->initDlg(hDlg);
 		} else if (LOWORD(wParam) == IDC_SAVE) {
-			((mpc_player*)GetWindowLong(hDlg, DWL_USER))->writeTags(hDlg);
+			((mpc_player*)GetWindowLongPtr(hDlg, DWLP_USER))->writeTags(hDlg);
 			EndDialog(hDlg, LOWORD(wParam));
 			return TRUE;
@@ -382,8 +414,4 @@
 {
 	DialogBoxParam(mod->hDllInstance, (LPCTSTR)IDD_INFO_BOX, hwnd, (DLGPROC)About, (LPARAM) this);
-
-	//loadTags(% infoBox);
-
-	//infoBox.ShowDialog();
 	return 0;
 }
