mirror of
https://github.com/dolphin-emu/dolphin.git
synced 2025-07-23 22:29:39 -06:00
MusicMod: Fixed the build
git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@3507 8ced0084-cf51-0410-be5f-012b33b47a6e
This commit is contained in:
108
Externals/MusicMod/Main/Src/Frame.cpp
vendored
108
Externals/MusicMod/Main/Src/Frame.cpp
vendored
@ -25,6 +25,7 @@
|
||||
|
||||
#include "IniFile.h" // Common
|
||||
#include "Log.h"
|
||||
#include "Setup.h"
|
||||
|
||||
#include "../../../../Source/Core/DolphinWX/Src/Globals.h" // DolphinWX
|
||||
#include "../../../../Source/Core/DolphinWX/Src/Frame.h"
|
||||
@ -39,10 +40,9 @@
|
||||
//////////////////////////////////
|
||||
|
||||
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////////////////
|
||||
// Declarations and definitions
|
||||
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
namespace MusicMod
|
||||
{
|
||||
bool GlobalMute = false;
|
||||
@ -51,16 +51,15 @@ namespace MusicMod
|
||||
int GlobalVolume = 125;
|
||||
extern bool dllloaded;
|
||||
|
||||
void ShowConsole();
|
||||
void ShowConsole(bool);
|
||||
void Init();
|
||||
}
|
||||
//////////////////////////////////
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////////////////
|
||||
// Change the brightness of a wxBitmap
|
||||
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
wxBitmap SetBrightness(wxBitmap _Bitmap, int _Brightness, bool Gray)
|
||||
{
|
||||
wxImage _Image = _Bitmap.ConvertToImage();
|
||||
@ -126,9 +125,12 @@ wxBitmap SetBrightness(wxBitmap _Bitmap, int _Brightness, bool Gray)
|
||||
|
||||
//wxMessageBox(Tmp);
|
||||
}
|
||||
//////////////////////////////////
|
||||
//////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////////////////
|
||||
// Create bitmaps
|
||||
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
#ifdef MUSICMOD
|
||||
void
|
||||
CFrame::MM_InitBitmaps(int Theme)
|
||||
@ -158,20 +160,22 @@ CFrame::MM_InitBitmaps(int Theme)
|
||||
// Update in case the bitmap has been updated
|
||||
//if (GetToolBar() != NULL) TheToolBar->FindById(Toolbar_Log)->SetNormalBitmap(m_Bitmaps[Toolbar_Log]);
|
||||
}
|
||||
//////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
|
||||
void
|
||||
CFrame::MM_PopulateGUI()
|
||||
//////////////////////////////////////////////////////////////////////////////////////////
|
||||
// Create GUI controls
|
||||
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
void CFrame::MM_PopulateGUI()
|
||||
{
|
||||
wxToolBar* toolBar = TheToolBar; // Shortcut
|
||||
|
||||
toolBar->AddSeparator();
|
||||
|
||||
MusicMod::Init();
|
||||
|
||||
// ---------------------------------------
|
||||
// ------------------------------------------------------------
|
||||
// Draw a rotated music label
|
||||
// ---------------------
|
||||
/*
|
||||
wxBitmap m_RotatedText(30, 15);
|
||||
wxMemoryDC dc;
|
||||
dc.SelectObject(m_RotatedText);
|
||||
@ -180,7 +184,7 @@ CFrame::MM_PopulateGUI()
|
||||
// Set outline and fill colors
|
||||
dc.SetBackground(BackgroundGrayBrush);
|
||||
dc.Clear();
|
||||
|
||||
// Set font style and color
|
||||
wxFont m_font(8, wxFONTFAMILY_DEFAULT, wxFONTSTYLE_NORMAL, wxFONTWEIGHT_BOLD);
|
||||
dc.SetFont(m_font);
|
||||
dc.SetTextForeground(wxColour(*wxLIGHT_GREY));
|
||||
@ -191,8 +195,8 @@ CFrame::MM_PopulateGUI()
|
||||
wxStaticBitmap * m_StaticBitmap = new wxStaticBitmap(toolBar, wxID_ANY, m_RotatedText);
|
||||
|
||||
toolBar->AddControl(m_StaticBitmap);
|
||||
// ---------------------------
|
||||
|
||||
*/
|
||||
// ------------------------------------------------------------
|
||||
|
||||
|
||||
mm_ToolMute = toolBar->AddTool(IDM_MUTE, _T("Mute"), m_Bitmaps[Toolbar_PluginDSP], _T("Mute music"));
|
||||
@ -210,16 +214,17 @@ CFrame::MM_PopulateGUI()
|
||||
*/
|
||||
|
||||
|
||||
// ---------------------
|
||||
// ---------------------------------------------------------
|
||||
/* Lots of code to get a label for the slider, in 2.9.0 AddControl accepts a label so then
|
||||
this code can be simplified a lot */
|
||||
// ---------
|
||||
wxPanel * mm_SliderPanel = new wxPanel(toolBar, IDS_VOLUME_PANEL, wxDefaultPosition, wxDefaultSize);
|
||||
mm_Slider = new wxSlider(mm_SliderPanel, IDS_VOLUME, 125, 0, 255, wxDefaultPosition, wxDefaultSize);
|
||||
wxPanel * mm_SliderPanel = new wxPanel(toolBar, IDM_VOLUME_PANEL, wxDefaultPosition, wxDefaultSize);
|
||||
mm_Slider = new wxSlider(mm_SliderPanel, IDM_VOLUME, 125, 0, 255, wxDefaultPosition, wxDefaultSize);
|
||||
//mm_Slider->SetToolTip("Change the music volume");
|
||||
mm_Slider->SetValue(MusicMod::GlobalVolume);
|
||||
// ---------------------------------------------------------
|
||||
|
||||
wxStaticText * mm_SliderText = new wxStaticText(mm_SliderPanel, IDS_VOLUME_LABEL, _T("Volume"), wxDefaultPosition, wxDefaultSize);
|
||||
wxStaticText * mm_SliderText = new wxStaticText(mm_SliderPanel, IDM_VOLUME_LABEL, _T("Volume"), wxDefaultPosition, wxDefaultSize);
|
||||
wxBoxSizer * mm_VolSizer = new wxBoxSizer(wxVERTICAL);
|
||||
mm_VolSizer->Add(mm_Slider, 0, wxEXPAND | wxALL, 0);
|
||||
mm_VolSizer->Add(mm_SliderText, 0, wxCENTER | wxALL, 0);
|
||||
@ -230,14 +235,16 @@ CFrame::MM_PopulateGUI()
|
||||
toolBar->AddControl((wxControl*)mm_SliderPanel);
|
||||
// ---------
|
||||
|
||||
mm_ToolLog = toolBar->AddTool(IDT_LOG, _T("Log"), m_Bitmaps[Toolbar_Log],
|
||||
wxT("Show or hide log. Enable the log window and restart Dolphin to show the DLL status."));
|
||||
// Console button disabled
|
||||
//mm_ToolLog = toolBar->AddTool(IDM_LOG, _T("Log"), m_Bitmaps[Toolbar_Log],
|
||||
// wxT("Show or hide log. Enable the log window and restart Dolphin to show the DLL status."));
|
||||
}
|
||||
//////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////////////////
|
||||
// Update GUI
|
||||
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
void
|
||||
CFrame::MM_UpdateGUI()
|
||||
{
|
||||
@ -263,6 +270,7 @@ CFrame::MM_UpdateGUI()
|
||||
mm_ToolPlay->SetNormalBitmap(m_Bitmaps[Toolbar_Pause]);
|
||||
}
|
||||
|
||||
/*
|
||||
if(MusicMod::bShowConsole)
|
||||
{
|
||||
mm_ToolLog->SetNormalBitmap(m_Bitmaps[Toolbar_Log]);
|
||||
@ -271,18 +279,19 @@ CFrame::MM_UpdateGUI()
|
||||
{
|
||||
mm_ToolLog->SetNormalBitmap(m_Bitmaps[Toolbar_Log_Dis]);
|
||||
}
|
||||
*/
|
||||
}
|
||||
//////////////////////////////////
|
||||
|
||||
|
||||
|
||||
// =======================================================================================
|
||||
//////////////////////////////////////////////////////////////////////////////////////////
|
||||
// Play and stop music
|
||||
// ---------------------------------------------------------------------------------------
|
||||
// <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
void
|
||||
CFrame::MM_OnPlay()
|
||||
{
|
||||
//INFO_LOG(AUDIO,"\nCFrame::OnPlayMusicMod > Begin\n");
|
||||
//NOTICE_LOG(AUDIO,"\nCFrame::OnPlayMusicMod > Begin\n");
|
||||
|
||||
// Save the volume
|
||||
MusicMod::GlobalVolume = mm_Slider->GetValue();
|
||||
@ -296,7 +305,7 @@ CFrame::MM_OnPlay()
|
||||
{
|
||||
if (Core::GetState() == Core::CORE_RUN)
|
||||
{
|
||||
//INFO_LOG(AUDIO,"CFrame::OnPlayMusicMod > Pause\n");
|
||||
//NOTICE_LOG(AUDIO,"CFrame::OnPlayMusicMod > Pause\n");
|
||||
if(!MusicMod::GlobalPause) // we may has set this elsewhere
|
||||
{
|
||||
MusicMod::GlobalPause = true;
|
||||
@ -308,7 +317,7 @@ CFrame::MM_OnPlay()
|
||||
}
|
||||
else
|
||||
{
|
||||
//INFO_LOG(AUDIO,"CFrame::OnPlayMusicMod > Play\n");
|
||||
//NOTICE_LOG(AUDIO,"CFrame::OnPlayMusicMod > Play\n");
|
||||
if(MusicMod::GlobalPause) // we may has set this elsewhere
|
||||
{
|
||||
MusicMod::GlobalPause = false;
|
||||
@ -332,11 +341,11 @@ CFrame::MM_OnStop()
|
||||
|
||||
// =======================================================================================
|
||||
// Mute music
|
||||
// ---------------------------------------------------------------------------------------
|
||||
// <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
void
|
||||
CFrame::MM_OnMute(wxCommandEvent& WXUNUSED (event))
|
||||
{
|
||||
//INFO_LOG(AUDIO,"CFrame::OnMute > Begin\n");
|
||||
//NOTICE_LOG(AUDIO,"CFrame::OnMute > Begin\n");
|
||||
//MessageBox(0, "", "", 0);
|
||||
|
||||
if(!MusicMod::GlobalMute)
|
||||
@ -364,11 +373,11 @@ CFrame::MM_OnMute(wxCommandEvent& WXUNUSED (event))
|
||||
|
||||
// =======================================================================================
|
||||
// Pause music
|
||||
// ---------------------------------------------------------------------------------------
|
||||
// <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
void
|
||||
CFrame::MM_OnPause(wxCommandEvent& WXUNUSED (event))
|
||||
{
|
||||
INFO_LOG(AUDIO,"CFrame::OnPause > Begin\n");
|
||||
NOTICE_LOG(AUDIO,"CFrame::OnPause > Begin\n");
|
||||
//MessageBox(0, "", "", 0);
|
||||
|
||||
if(!MusicMod::GlobalPause)
|
||||
@ -392,14 +401,12 @@ CFrame::MM_OnPause(wxCommandEvent& WXUNUSED (event))
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
// =======================================================================================
|
||||
// Change volume
|
||||
// ---------------------------------------------------------------------------------------
|
||||
// <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
void CFrame::MM_OnVolume(wxScrollEvent& event)
|
||||
{
|
||||
//INFO_LOG(AUDIO,"CFrame::OnVolume > Begin <%i>\n", event.GetPosition());
|
||||
//NOTICE_LOG(AUDIO,"CFrame::OnVolume > Begin <%i>\n", event.GetPosition());
|
||||
//MessageBox(0, "", "", 0);
|
||||
|
||||
//if(event.GetEventType() == wxEVT_SCROLL_PAGEUP || event.GetEventType() == wxEVT_SCROLL_PAGEDOWN)
|
||||
@ -428,38 +435,29 @@ void CFrame::MM_OnVolume(wxScrollEvent& event)
|
||||
//=======================================================================================
|
||||
|
||||
|
||||
|
||||
// =======================================================================================
|
||||
// Show log
|
||||
// ---------------------------------------------------------------------------------------
|
||||
void CFrame::MM_OnLog(wxCommandEvent& event)
|
||||
// <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
void CFrame::MM_OnLog(bool Show)
|
||||
{
|
||||
//INFO_LOG(AUDIO,"CFrame::OnLog > Begin\n");
|
||||
//NOTICE_LOG(AUDIO, "CFrame::OnLog > Begin\n");
|
||||
//MessageBox(0, "", "", 0);
|
||||
//NOTICE_LOG(AUDIO, "MM_OnLog: %i", MusicMod::dllloaded);
|
||||
|
||||
if(!MusicMod::dllloaded) return; // Avoid crash
|
||||
// Check that Init() was run
|
||||
if(!MusicMod::dllloaded) MusicMod::Init();
|
||||
// Check that it succeeded
|
||||
if(!MusicMod::dllloaded) return;
|
||||
|
||||
MusicMod::bShowConsole = !MusicMod::bShowConsole;
|
||||
|
||||
if(MusicMod::bShowConsole)
|
||||
/* What we do here is run StartConsoleWin() in Common directly after each
|
||||
other first in the exe then in the DLL, sometimes this would give me a rampant memory
|
||||
usage increase until the exe crashed at 700 MB memory usage or something like that.
|
||||
For that reason I'm trying to sleep for a moment between them here. */
|
||||
{ MusicMod::ShowConsole(); Sleep(100); Player_Console(true); }
|
||||
else
|
||||
{
|
||||
#if defined (_WIN32)
|
||||
Console::Close(); Player_Console(false);
|
||||
#endif
|
||||
}
|
||||
MusicMod::bShowConsole = Show;
|
||||
MusicMod::ShowConsole(MusicMod::bShowConsole);
|
||||
|
||||
IniFile file;
|
||||
file.Load("Plainamp.ini");
|
||||
file.Set("Interface", "ShowConsole", MusicMod::bShowConsole);
|
||||
file.Save("Plainamp.ini");
|
||||
|
||||
UpdateGUI();
|
||||
//UpdateGUI();
|
||||
}
|
||||
//=======================================================================================
|
||||
|
||||
|
72
Externals/MusicMod/Main/Src/Main.cpp
vendored
72
Externals/MusicMod/Main/Src/Main.cpp
vendored
@ -98,7 +98,7 @@ void StructSort (std::vector <MyFilesStructure> &MyFiles)
|
||||
{
|
||||
MyFilesStructure temp;
|
||||
|
||||
//INFO_LOG(AUDIO,"StructSort > Begin\n");
|
||||
//NOTICE_LOG(AUDIO,"StructSort > Begin\n");
|
||||
|
||||
for(int i = 0; i < MyFiles.size() - 1; i++)
|
||||
{
|
||||
@ -119,16 +119,29 @@ void StructSort (std::vector <MyFilesStructure> &MyFiles)
|
||||
std::cout << i << " " << MyFiles[i].path.c_str() << "#" << MyFiles[i].offset << "\n";
|
||||
}
|
||||
|
||||
//INFO_LOG(AUDIO,"StructSort > Done\n");
|
||||
//NOTICE_LOG(AUDIO,"StructSort > Done\n");
|
||||
}
|
||||
// ============================
|
||||
|
||||
|
||||
// =======================================================================================
|
||||
/* Run these things once */
|
||||
/* Run these things once when Dolphin starts */
|
||||
// ------------------------
|
||||
void ShowConsole()
|
||||
void ShowConsole(bool Show)
|
||||
{
|
||||
if (Show)
|
||||
{
|
||||
/* What we do here is run StartConsoleWin() in Common directly after each
|
||||
other first in the exe then in the DLL, sometimes this would give me a rampant memory
|
||||
usage increase until the exe crashed at 700 MB memory usage or something like that.
|
||||
For that reason I'm trying to sleep for a moment between them here. */
|
||||
Sleep(100);
|
||||
Player_Console(true);
|
||||
}
|
||||
else
|
||||
{
|
||||
Player_Console(false);
|
||||
}
|
||||
// Console::Open(100, 2000, "MusicMod", true); // Give room for 2000 rows
|
||||
}
|
||||
|
||||
@ -149,13 +162,13 @@ void Init()
|
||||
// ---------------------------------------
|
||||
// Make a debugging window
|
||||
// ---------------------
|
||||
if(MusicMod::bShowConsole) ShowConsole();
|
||||
//if(MusicMod::bShowConsole) ShowConsole();
|
||||
|
||||
// Write version
|
||||
#ifdef _M_X64
|
||||
INFO_LOG(AUDIO,"64 bit version\n");
|
||||
NOTICE_LOG(AUDIO,"64 bit version\n");
|
||||
#else
|
||||
INFO_LOG(AUDIO,"32 bit version\n");
|
||||
NOTICE_LOG(AUDIO,"32 bit version\n");
|
||||
#endif
|
||||
// -----------
|
||||
|
||||
@ -165,7 +178,7 @@ void Init()
|
||||
// Show DLL status
|
||||
Player_Main(MusicMod::bShowConsole);
|
||||
//play_file("c:\\demo36_02.ast");
|
||||
//INFO_LOG(AUDIO,"DLL loaded\n");
|
||||
//NOTICE_LOG(AUDIO,"DLL loaded\n");
|
||||
|
||||
dllloaded = true; // Do this once
|
||||
}
|
||||
@ -173,15 +186,17 @@ void Init()
|
||||
|
||||
|
||||
// =======================================================================================
|
||||
/* This will read the GC file system. */
|
||||
/* Function: Read the GC file system when a game is booted
|
||||
Called from: BootManager.cpp */
|
||||
// ------------------------
|
||||
void Main(std::string FileName)
|
||||
{
|
||||
//
|
||||
DiscIO::IVolume* pVolume = DiscIO::CreateVolumeFromFilename(FileName.c_str());
|
||||
|
||||
DiscIO::IVolume* pVolume = DiscIO::CreateVolumeFromFilename(FileName);
|
||||
//
|
||||
my_pFileSystem = new DiscIO::CFileSystemGCWii(pVolume);
|
||||
// Check that it worked
|
||||
if (my_pFileSystem->m_FileInfoVector.size() == 0) NOTICE_LOG(AUDIO, "Volume creation failed")
|
||||
|
||||
/* We have to sort the files according to offset so that out scan in Blob.cpp works.
|
||||
Because StructSort() only works for MyFilesStructure I copy the offset and filenames
|
||||
@ -202,7 +217,7 @@ void Main(std::string FileName)
|
||||
LPSECURITY_ATTRIBUTES attr;
|
||||
attr = NULL;
|
||||
MusicPath = "Music\\";
|
||||
INFO_LOG(AUDIO,"Created a Music directory\n");
|
||||
NOTICE_LOG(AUDIO,"Created a Music directory\n");
|
||||
CreateDirectory(MusicPath.c_str(), attr);
|
||||
// ----------------------------------------------------------------------------------------
|
||||
}
|
||||
@ -216,8 +231,6 @@ void CheckFile(std::string File, int FileNumber)
|
||||
// Do nothing if we found the same file again
|
||||
if (CurrentFile == File) return;
|
||||
|
||||
//INFO_LOG(AUDIO,">>>> (%i)Current read %s <%u = %ux%i> <block %u>\n", i, CurrentFiles[i].path.c_str(), offset, CurrentFiles[i].offset, size);
|
||||
|
||||
// Check if it's a music file
|
||||
if (CheckFileEnding(File.c_str()))
|
||||
{
|
||||
@ -227,7 +240,7 @@ void CheckFile(std::string File, int FileNumber)
|
||||
if (CurrentPlayFile == File) return;
|
||||
|
||||
// Notify the user
|
||||
INFO_LOG(AUDIO,"\n >>> (%i/%i) Match %s\n\n", FileNumber, MyFiles.size(), File.c_str());
|
||||
NOTICE_LOG(AUDIO,"\n >>> (%i/%i) Match %s\n", FileNumber, MyFiles.size(), File.c_str());
|
||||
|
||||
// Save the matched file
|
||||
CurrentPlayFile = File;
|
||||
@ -236,7 +249,7 @@ void CheckFile(std::string File, int FileNumber)
|
||||
// We will now save the file to the PC hard drive
|
||||
// ------------------
|
||||
// Get the filename
|
||||
std::size_t pointer = File.find_last_of("\\");
|
||||
std::size_t pointer = File.find_last_of("/");
|
||||
std::string fragment = File.substr (0, (pointer-0));
|
||||
int compare = File.length() - fragment.length(); // Get the length of the filename
|
||||
fragment = File.substr ((pointer+1), compare); // Now we have the filename
|
||||
@ -245,9 +258,11 @@ void CheckFile(std::string File, int FileNumber)
|
||||
std::string FilePath = (MusicPath + fragment);
|
||||
|
||||
WritingFile = true; // Avoid detecting the file we are writing
|
||||
INFO_LOG(AUDIO,"Writing <%s> to <%s>\n", File.c_str(), FilePath.c_str());
|
||||
my_pFileSystem->ExportFile(File.c_str(), FilePath.c_str());
|
||||
NOTICE_LOG(AUDIO, "Writing '%s' to '%s'", File.c_str(), FilePath.c_str());
|
||||
if (!my_pFileSystem->ExportFile(File.c_str(), FilePath.c_str()))
|
||||
NOTICE_LOG(AUDIO, "ERROR: ExportFile failed");
|
||||
WritingFile = false;
|
||||
// ------------------------------------------------------
|
||||
|
||||
// ---------------------------------------------------------------------------------------
|
||||
// Play the file we found
|
||||
@ -256,8 +271,9 @@ void CheckFile(std::string File, int FileNumber)
|
||||
{
|
||||
Player_Play((char*)FilePath.c_str()); // retype it from const char* to char*
|
||||
} else {
|
||||
INFO_LOG(AUDIO,"Warning > Music DLL is not loaded");
|
||||
NOTICE_LOG(AUDIO, "Warning > Music DLL is not loaded");
|
||||
}
|
||||
// ------------------------------------------------------
|
||||
|
||||
// ---------------------------------------------------------------------------------------
|
||||
// Remove the last file, if any
|
||||
@ -266,11 +282,12 @@ void CheckFile(std::string File, int FileNumber)
|
||||
{
|
||||
if(!remove(CurrentPlayFilePath.c_str()))
|
||||
{
|
||||
INFO_LOG(AUDIO,"The program failed to remove <%s>\n", CurrentPlayFilePath.c_str());
|
||||
NOTICE_LOG(AUDIO,"The program failed to remove '%s'", CurrentPlayFilePath.c_str());
|
||||
} else {
|
||||
INFO_LOG(AUDIO,"The program removed <%s>\n", CurrentPlayFilePath.c_str());
|
||||
NOTICE_LOG(AUDIO,"The program removed '%s'", CurrentPlayFilePath.c_str());
|
||||
}
|
||||
}
|
||||
// ------------------------------------------------------
|
||||
|
||||
// ---------------------------------------------------------------------------------------
|
||||
// Save the current playing file
|
||||
@ -279,7 +296,7 @@ void CheckFile(std::string File, int FileNumber)
|
||||
}
|
||||
|
||||
// Tell the user about the files we ignored
|
||||
INFO_LOG(AUDIO,"(%i/%i) Ignored %s\n", FileNumber, MyFiles.size(), File.c_str());
|
||||
NOTICE_LOG(AUDIO,"(%i/%i) Ignored '%s'\n", FileNumber, MyFiles.size(), File.c_str());
|
||||
|
||||
// Update the current file
|
||||
CurrentFile = File;
|
||||
@ -299,8 +316,6 @@ void FindFilename(u64 offset, u64 size)
|
||||
upp the scanning */
|
||||
if(PowerPC::GetState() == PowerPC::CPUState::CPU_RUNNING && offset != 0 && !WritingFile)
|
||||
{
|
||||
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////////////////
|
||||
/* Get the filename. Here we go through all files until we come to the file that has
|
||||
the matching offset. Before MyFiles has data this loop will go nowhere. We have to
|
||||
@ -310,6 +325,9 @@ void FindFilename(u64 offset, u64 size)
|
||||
// ---------------------------------------------------------------------------------------
|
||||
for (int i = 0; i < (int)(MyFiles.size() - 1); ++i)
|
||||
{
|
||||
// Log
|
||||
//NOTICE_LOG(AUDIO, ">>> Comparing %s [#%i, Size: %i, Location: %u] with %u", MyFiles[i].path.c_str(), i, size, MyFiles[i].offset, offset);
|
||||
|
||||
// ---------------------------------------------------------------------------------------
|
||||
/* If we assume that myoffset is the begginning of every file this works.
|
||||
Suppose there are three files
|
||||
@ -332,6 +350,12 @@ void FindFilename(u64 offset, u64 size)
|
||||
// Stop checking
|
||||
break;
|
||||
}
|
||||
|
||||
// If the file check failed
|
||||
if (i == (int)(MyFiles.size() - 1) - 1)
|
||||
{
|
||||
NOTICE_LOG(AUDIO, "ERROR: GC filename search failed");
|
||||
}
|
||||
}
|
||||
} // This ends the entire filescan
|
||||
// =======================================================================================
|
||||
|
Reference in New Issue
Block a user