diff --git a/Branches/MusicMod/Common/Src/Console.cpp b/Branches/MusicMod/Common/Src/Console.cpp index be74309107..976fa81d1d 100644 --- a/Branches/MusicMod/Common/Src/Console.cpp +++ b/Branches/MusicMod/Common/Src/Console.cpp @@ -50,10 +50,11 @@ ////////////////////////////////////////////////////////////////////////////////////////// // Start console window -// ŻŻŻŻŻŻŻŻŻŻ -// Width and height is the size of console window, if you specify fname, -// the output will also be writton to this file. The file pointer is automatically closed -// when you close the app +/* ŻŻŻŻŻŻŻŻŻŻ + Width and height is the size of console window, if you specify fname, the output will + also be writton to this file. The file pointer is automatically closed + when you close the application. */ +// --------------------- void StartConsoleWin(int width, int height, char* fname) { #ifdef MM_DEBUG @@ -64,13 +65,19 @@ void StartConsoleWin(int width, int height, char* fname) AllocConsole(); // --------------------------------------------------------------------------------------- - //SetConsoleTitle("Debug Window"); + // Set console window title SetConsoleTitle(fname); + + // Get window handle to write to __hStdOut = GetStdHandle(STD_OUTPUT_HANDLE); - COORD co = {width,height}; + // Create coordinates table + COORD co = {width, height}; + + // Set the innteral letter space SetConsoleScreenBufferSize(__hStdOut, co); + // Set the window width and height SMALL_RECT coo = {0,0, (width - 1),50}; // Top, left, right, bottom SetConsoleWindowInfo(__hStdOut, TRUE, &coo); #endif @@ -94,33 +101,36 @@ void StartConsoleWin(int width, int height, char* fname) // ŻŻŻŻŻŻŻŻŻŻ int wprintf(char *fmt, ...) { -#ifdef MM_DEBUG - char s[300]; - va_list argptr; - int cnt; + #ifdef MM_DEBUG + char s[500]; // Bigget message size + va_list argptr; + int cnt; - va_start(argptr, fmt); - cnt = vsprintf(s, fmt, argptr); - va_end(argptr); + va_start(argptr, fmt); + cnt = vsprintf(s, fmt, argptr); + va_end(argptr); - DWORD cCharsWritten; + DWORD cCharsWritten; - // --------------------------------------------------------------------------------- -#ifndef MM_DEBUG_FILEONLY - if(__hStdOut) - WriteConsole(__hStdOut, s, strlen(s), &cCharsWritten, NULL); -#endif - // --------------------------------------------------------------------------------- + // --------------------------------------------------- + // Write to console + // -------------- + #ifndef MM_DEBUG_FILEONLY + if(__hStdOut) + WriteConsole(__hStdOut, s, strlen(s), &cCharsWritten, NULL); + #endif + // ---------------------------- + // Write to file if(__fStdOut) { fprintf(__fStdOut, s); - fflush(__fStdOut); // Write file now + //fflush(__fStdOut); // Write file now, don't wait } - return(cnt); -#else - return 0; -#endif + return(cnt); + #else + return 0; + #endif } ///////////////////////////// \ No newline at end of file diff --git a/Branches/MusicMod/Main/Src/Frame.cpp b/Branches/MusicMod/Main/Src/Frame.cpp index 666df0a5f0..c0b7c13eeb 100644 --- a/Branches/MusicMod/Main/Src/Frame.cpp +++ b/Branches/MusicMod/Main/Src/Frame.cpp @@ -297,18 +297,19 @@ CFrame::MM_UpdateGUI() +// ======================================================================================= +// Play and stop music +// --------------------------------------------------------------------------------------- void CFrame::MM_OnPlay() { - //MessageBox(0, "CFrame::OnPlay > Begin", "", 0); - wprintf("\nCFrame::OnPlayMusicMod > Begin\n"); - + //wprintf("\nCFrame::OnPlayMusicMod > Begin\n"); if (Core::GetState() != Core::CORE_UNINITIALIZED) { if (Core::GetState() == Core::CORE_RUN) { - wprintf("CFrame::OnPlayMusicMod > Pause\n"); + //wprintf("CFrame::OnPlayMusicMod > Pause\n"); if(!MusicMod::GlobalPause) // we may has set this elsewhere { MusicMod::GlobalPause = true; @@ -316,12 +317,11 @@ CFrame::MM_OnPlay() { Player_Pause(); } - } } else { - wprintf("CFrame::OnPlayMusicMod > Play\n"); + //wprintf("CFrame::OnPlayMusicMod > Play\n"); if(MusicMod::GlobalPause) // we may has set this elsewhere { MusicMod::GlobalPause = false; @@ -332,9 +332,15 @@ CFrame::MM_OnPlay() } } } - } +void +CFrame::MM_OnStop() +{ + Player_Stop(); + MusicMod::GlobalPause = false; +} +// ======================================================================================= // ======================================================================================= diff --git a/Branches/MusicMod/Main/Src/Main.cpp b/Branches/MusicMod/Main/Src/Main.cpp index a48d0ff4d3..830594db24 100644 --- a/Branches/MusicMod/Main/Src/Main.cpp +++ b/Branches/MusicMod/Main/Src/Main.cpp @@ -79,7 +79,6 @@ void StructSort (std::vector &MyFiles) { for (int j = i + 1; j < MyFiles.size(); j++) { - //if (printerStock[ i ].brand > printerStock[ j ].brand) //comparing brands if (MyFiles[ i ].offset > MyFiles[ j ].offset) //comparing cost { temp = MyFiles[ i ]; // Swapping entire struct @@ -92,7 +91,6 @@ void StructSort (std::vector &MyFiles) for (long i=1; i<(long)MyFiles.size(); ++i) { - //cout << printerStock.at(i).brand.c_str() << printerStock.at(i).cost << "\n"; std::cout << i << " " << MyFiles[i].path.c_str() << "#" << MyFiles[i].offset << "\n"; } @@ -122,19 +120,21 @@ void Main(std::string FileName) MyFiles.at(i).path = my_pFileSystem->m_FileInfoVector.at(i).m_FullPath; } + // Sort the files by offset StructSort(MyFiles); // These things below will not need to be updated after a new game is started if (dllloaded) return; - Player_Main(bShowConsole); // Call the DLL for the first time + // Call the DLL for the first time + Player_Main(bShowConsole); //play_file("c:\\demo36_02.ast"); wprintf("DLL loaded\n"); dllloaded = true; // Do this once - // --------------------------------------------------------------------------------------- // Make Music directory + // ------------------------- LPSECURITY_ATTRIBUTES attr; attr = NULL; MusicPath = "Music\\"; @@ -272,13 +272,10 @@ void CheckFile(u64 offset, u64 size) // --------------------------------------------------------------------------------------- } } - - //wprintf("Blob.cpp:Read <%i> <%i> <%i> <%i>\n", offset, size, out_ptr); } // This ends the entire filescan // ======================================================================================= - } } // end of namespace \ No newline at end of file diff --git a/Branches/MusicMod/Player/Src/PlayerExport.cpp b/Branches/MusicMod/Player/Src/PlayerExport.cpp index 3251f60566..70726172ca 100644 --- a/Branches/MusicMod/Player/Src/PlayerExport.cpp +++ b/Branches/MusicMod/Player/Src/PlayerExport.cpp @@ -87,6 +87,18 @@ void Player_Play(char * FileName) GlobalPause = false; } +void Player_Stop() +{ + Playback::Stop(); + //wprintf("Stop\n"); + playlist->RemoveAll(); + + CurrentlyPlayingFile = ""; + + GlobalPause = false; +} + + void Player_Pause() { if (!GlobalPause) @@ -146,7 +158,7 @@ void Player_Volume(int a) void ShowConsole() { - StartConsoleWin(100, 2000, "MusicMod"); // give room for 2000 rows + //StartConsoleWin(100, 2000, "MusicMod"); // give room for 2000 rows } diff --git a/Branches/MusicMod/Player/Src/PlayerExport.h b/Branches/MusicMod/Player/Src/PlayerExport.h index 0f1b63ad02..bb95374a91 100644 --- a/Branches/MusicMod/Player/Src/PlayerExport.h +++ b/Branches/MusicMod/Player/Src/PlayerExport.h @@ -41,6 +41,7 @@ void MakeTime(); EXPORT void Player_Main(bool Console); EXPORT void Player_Console(bool Console); EXPORT void Player_Play(char *); +EXPORT void Player_Stop(); EXPORT void Player_Pause(); EXPORT void Player_Unpause(); EXPORT void Player_Mute(); diff --git a/Source/Core/DolphinWX/Src/Frame.cpp b/Source/Core/DolphinWX/Src/Frame.cpp index 4aabb28a83..60bf93e197 100644 --- a/Source/Core/DolphinWX/Src/Frame.cpp +++ b/Source/Core/DolphinWX/Src/Frame.cpp @@ -246,9 +246,11 @@ EVT_HOST_COMMAND(wxID_ANY, CFrame::OnHostMessage) EVT_TIMER(wxID_ANY, CFrame::OnTimer) #endif END_EVENT_TABLE() +///////////////////////////////////////////////// + // ---------------------------------------------------------------------------- -// implementation +// Creation and close, quit functions // ---------------------------------------------------------------------------- CFrame::CFrame(wxFrame* parent, @@ -350,6 +352,24 @@ CFrame::~CFrame() #endif } +void CFrame::OnQuit(wxCommandEvent& WXUNUSED (event)) +{ + Close(true); +} + +void CFrame::OnClose(wxCloseEvent& event) +{ + // Don't forget the skip of the window won't be destroyed + event.Skip(); + + if (Core::GetState() != Core::CORE_UNINITIALIZED) + { + Core::Stop(); + UpdateGUI(); + } +} +///////////////////////////////////////////////// + ////////////////////////////////////////////////////////////////////////////////////////// // Input and host messages diff --git a/Source/Core/DolphinWX/Src/Frame.h b/Source/Core/DolphinWX/Src/Frame.h index b0f8641d0c..1734db928d 100644 --- a/Source/Core/DolphinWX/Src/Frame.h +++ b/Source/Core/DolphinWX/Src/Frame.h @@ -105,7 +105,7 @@ class CFrame : public wxFrame wxToolBarToolBase* mm_ToolMute, * mm_ToolPlay, * mm_ToolLog; void MM_UpdateGUI(); void MM_PopulateGUI(); void MM_InitBitmaps(int Theme); - void MM_OnPlay(); + void MM_OnPlay(); void MM_OnStop(); void MM_OnMute(wxCommandEvent& event); void MM_OnPause(wxCommandEvent& event); void MM_OnVolume(wxScrollEvent& event); @@ -169,7 +169,7 @@ class CFrame : public wxFrame void OnQuit(wxCommandEvent& event); void OnHelp(wxCommandEvent& event); - void OnOpen(wxCommandEvent& event); void DoOpen(bool Boot); // File + void OnOpen(wxCommandEvent& event); void DoOpen(bool Boot); // File menu void OnRefresh(wxCommandEvent& event); void OnBrowse(wxCommandEvent& event); diff --git a/Source/Core/DolphinWX/Src/FrameTools.cpp b/Source/Core/DolphinWX/Src/FrameTools.cpp index 03b5217976..fa9e41234c 100644 --- a/Source/Core/DolphinWX/Src/FrameTools.cpp +++ b/Source/Core/DolphinWX/Src/FrameTools.cpp @@ -138,10 +138,10 @@ void CFrame::CreateMenu() pOptionsMenu->Append(IDM_CONFIG_DSP_PLUGIN, _T("&DSP settings")); pOptionsMenu->Append(IDM_CONFIG_PAD_PLUGIN, _T("&Pad settings")); pOptionsMenu->Append(IDM_CONFIG_WIIMOTE_PLUGIN, _T("&Wiimote settings")); -#ifdef _WIN32 - pOptionsMenu->AppendSeparator(); - pOptionsMenu->Append(IDM_TOGGLE_FULLSCREEN, _T("&Fullscreen\tAlt+Enter")); -#endif + #ifdef _WIN32 + pOptionsMenu->AppendSeparator(); + pOptionsMenu->Append(IDM_TOGGLE_FULLSCREEN, _T("&Fullscreen\tAlt+Enter")); + #endif m_pMenuBar->Append(pOptionsMenu, _T("&Options")); // Misc menu @@ -422,41 +422,18 @@ void CFrame::OnChangeDisc(wxCommandEvent& WXUNUSED (event)) // ============= -void CFrame::OnQuit(wxCommandEvent& WXUNUSED (event)) +void CFrame::OnRefresh(wxCommandEvent& WXUNUSED (event)) { - Close(true); -} - - -void CFrame::OnClose(wxCloseEvent& event) -{ - // Don't forget the skip of the window won't be destroyed - event.Skip(); - - if (Core::GetState() != Core::CORE_UNINITIALIZED) + if (m_GameListCtrl) { - Core::Stop(); - UpdateGUI(); + m_GameListCtrl->Update(); } } -void CFrame::OnHelp(wxCommandEvent& event) + +void CFrame::OnBrowse(wxCommandEvent& WXUNUSED (event)) { - switch (event.GetId()) - { - case IDM_HELPABOUT: - { - AboutDolphin frame(this); - frame.ShowModal(); - break; - } - case IDM_HELPWEBSITE: - File::Launch("http://www.dolphin-emu.com/"); - break; - case IDM_HELPGOOGLECODE: - File::Launch("http://code.google.com/p/dolphin-emu/"); - break; - } + m_GameListCtrl->BrowseForDirectory(); } @@ -509,8 +486,13 @@ void CFrame::OnPlay(wxCommandEvent& WXUNUSED (event)) } // ============= + void CFrame::DoStop() { + #ifdef MUSICMOD // Music modification + MM_OnStop(); + #endif + if (Core::GetState() != Core::CORE_UNINITIALIZED) { Core::Stop(); @@ -545,15 +527,6 @@ void CFrame::OnStop(wxCommandEvent& WXUNUSED (event)) } -void CFrame::OnRefresh(wxCommandEvent& WXUNUSED (event)) -{ - if (m_GameListCtrl) - { - m_GameListCtrl->Update(); - } -} - - void CFrame::OnConfigMain(wxCommandEvent& WXUNUSED (event)) { CConfigMain ConfigMain(this); @@ -595,10 +568,31 @@ void CFrame::OnPluginWiimote(wxCommandEvent& WXUNUSED (event)) ); } -void CFrame::OnBrowse(wxCommandEvent& WXUNUSED (event)) + +void CFrame::OnHelp(wxCommandEvent& event) { - m_GameListCtrl->BrowseForDirectory(); + switch (event.GetId()) + { + case IDM_HELPABOUT: + { + AboutDolphin frame(this); + frame.ShowModal(); + break; + } + case IDM_HELPWEBSITE: + File::Launch("http://www.dolphin-emu.com/"); + break; + case IDM_HELPGOOGLECODE: + File::Launch("http://code.google.com/p/dolphin-emu/"); + break; + } } +// ========= // Toolbar + + +// ======================================================= +// Miscellaneous menu +// ------------- void CFrame::OnMemcard(wxCommandEvent& WXUNUSED (event)) { @@ -610,6 +604,8 @@ void CFrame::OnShow_CheatsWindow(wxCommandEvent& WXUNUSED (event)) { CheatsWindow = new wxCheatsWindow(this, wxDefaultPosition, wxSize(600, 390)); } +// ============= + // =======================================================