MusicMod: Added music modification, it currently only works in Windows

git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@1736 8ced0084-cf51-0410-be5f-012b33b47a6e
This commit is contained in:
John Peterson
2009-01-03 01:38:44 +00:00
parent 55db229929
commit 264056972d
69 changed files with 5299 additions and 511 deletions
+245
View File
@@ -0,0 +1,245 @@
<?xml version="1.0" encoding="Windows-1252"?>
<VisualStudioProject
ProjectType="Visual C++"
Version="9,00"
Name="Common"
ProjectGUID="{DE7C596C-CBC4-4278-8909-146D63990803}"
TargetFrameworkVersion="131072"
>
<Platforms>
<Platform
Name="Win32"
/>
<Platform
Name="x64"
/>
</Platforms>
<ToolFiles>
</ToolFiles>
<Configurations>
<Configuration
Name="Debug|Win32"
OutputDirectory="$(SolutionDir)$(ConfigurationName)"
IntermediateDirectory="$(ConfigurationName)"
ConfigurationType="4"
>
<Tool
Name="VCPreBuildEventTool"
/>
<Tool
Name="VCCustomBuildTool"
/>
<Tool
Name="VCXMLDataGeneratorTool"
/>
<Tool
Name="VCWebServiceProxyGeneratorTool"
/>
<Tool
Name="VCMIDLTool"
/>
<Tool
Name="VCCLCompilerTool"
/>
<Tool
Name="VCManagedResourceCompilerTool"
/>
<Tool
Name="VCResourceCompilerTool"
/>
<Tool
Name="VCPreLinkEventTool"
/>
<Tool
Name="VCLibrarianTool"
/>
<Tool
Name="VCALinkTool"
/>
<Tool
Name="VCXDCMakeTool"
/>
<Tool
Name="VCBscMakeTool"
/>
<Tool
Name="VCFxCopTool"
/>
<Tool
Name="VCPostBuildEventTool"
/>
</Configuration>
<Configuration
Name="Debug|x64"
OutputDirectory="$(SolutionDir)$(PlatformName)\$(ConfigurationName)"
IntermediateDirectory="$(PlatformName)\$(ConfigurationName)"
ConfigurationType="4"
>
<Tool
Name="VCPreBuildEventTool"
/>
<Tool
Name="VCCustomBuildTool"
/>
<Tool
Name="VCXMLDataGeneratorTool"
/>
<Tool
Name="VCWebServiceProxyGeneratorTool"
/>
<Tool
Name="VCMIDLTool"
TargetEnvironment="3"
/>
<Tool
Name="VCCLCompilerTool"
/>
<Tool
Name="VCManagedResourceCompilerTool"
/>
<Tool
Name="VCResourceCompilerTool"
/>
<Tool
Name="VCPreLinkEventTool"
/>
<Tool
Name="VCLibrarianTool"
/>
<Tool
Name="VCALinkTool"
/>
<Tool
Name="VCXDCMakeTool"
/>
<Tool
Name="VCBscMakeTool"
/>
<Tool
Name="VCFxCopTool"
/>
<Tool
Name="VCPostBuildEventTool"
/>
</Configuration>
<Configuration
Name="Release|Win32"
OutputDirectory="$(SolutionDir)$(ConfigurationName)"
IntermediateDirectory="$(ConfigurationName)"
ConfigurationType="4"
>
<Tool
Name="VCPreBuildEventTool"
/>
<Tool
Name="VCCustomBuildTool"
/>
<Tool
Name="VCXMLDataGeneratorTool"
/>
<Tool
Name="VCWebServiceProxyGeneratorTool"
/>
<Tool
Name="VCMIDLTool"
/>
<Tool
Name="VCCLCompilerTool"
/>
<Tool
Name="VCManagedResourceCompilerTool"
/>
<Tool
Name="VCResourceCompilerTool"
/>
<Tool
Name="VCPreLinkEventTool"
/>
<Tool
Name="VCLibrarianTool"
/>
<Tool
Name="VCALinkTool"
/>
<Tool
Name="VCXDCMakeTool"
/>
<Tool
Name="VCBscMakeTool"
/>
<Tool
Name="VCFxCopTool"
/>
<Tool
Name="VCPostBuildEventTool"
/>
</Configuration>
<Configuration
Name="Release|x64"
OutputDirectory="$(SolutionDir)$(PlatformName)\$(ConfigurationName)"
IntermediateDirectory="$(PlatformName)\$(ConfigurationName)"
ConfigurationType="4"
>
<Tool
Name="VCPreBuildEventTool"
/>
<Tool
Name="VCCustomBuildTool"
/>
<Tool
Name="VCXMLDataGeneratorTool"
/>
<Tool
Name="VCWebServiceProxyGeneratorTool"
/>
<Tool
Name="VCMIDLTool"
TargetEnvironment="3"
/>
<Tool
Name="VCCLCompilerTool"
/>
<Tool
Name="VCManagedResourceCompilerTool"
/>
<Tool
Name="VCResourceCompilerTool"
/>
<Tool
Name="VCPreLinkEventTool"
/>
<Tool
Name="VCLibrarianTool"
/>
<Tool
Name="VCALinkTool"
/>
<Tool
Name="VCXDCMakeTool"
/>
<Tool
Name="VCBscMakeTool"
/>
<Tool
Name="VCFxCopTool"
/>
<Tool
Name="VCPostBuildEventTool"
/>
</Configuration>
</Configurations>
<References>
</References>
<Files>
<File
RelativePath=".\Src\Console.cpp"
>
</File>
<File
RelativePath=".\Src\Console.h"
>
</File>
</Files>
<Globals>
</Globals>
</VisualStudioProject>
+142
View File
@@ -0,0 +1,142 @@
// Copyright (C) 2003-2008 Dolphin Project.
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, version 2.0.
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License 2.0 for more details.
// A copy of the GPL 2.0 should have been included with the program.
// If not, see http://www.gnu.org/licenses/
// Official SVN repository and contact information can be found at
// http://code.google.com/p/dolphin-emu/
//////////////////////////////////////////////////////////////////////////////////////////
// Include
// ¯¯¯¯¯¯¯¯¯¯¯¯¯¯
//#include <iostream>
#include <string>
//#include "stdafx.h"
#include <stdio.h>
#include <windows.h>
//#include <tchar.h>
//////////////////////////////////////////////////////////////////////////////////////////
// Declarations and definitions
// ¯¯¯¯¯¯¯¯¯¯
// Enable or disable logging to screen and file
#define MM_DEBUG
//#define MM_DEBUG_FILEONLY
// ---------------------------------------------------------------------------------------
// _T
/*
#ifdef _UNICODE
#define _T(x) L ## x
#else // _UNICODE
#define _T(x) x
#endif // _UNICODE
To be used with
//wprintf(_T("Please enter a number:"));
//wprintf("Please enter a number");
//wprintf(L"Please enter a number");
*/
// ---------------------------------------------------------------------------------------
// ---------------------------------------------------------------------------------------
#ifdef MM_DEBUG
FILE* __fStdOut = NULL;
#endif
#ifndef MM_DEBUG_FILEONLY
HANDLE __hStdOut = NULL;
#endif
/////////////////////////////
//////////////////////////////////////////////////////////////////////////////////////////
// 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
//void startConsoleWin(int width=80, int height=2225, char* fname = NULL);
void StartConsoleWin(int width, int height, char* fname)
{
#ifdef MM_DEBUG
#ifndef MM_DEBUG_FILEONLY
// ---------------------------------------------------------------------------------------
// Allocate console
AllocConsole();
// ---------------------------------------------------------------------------------------
//SetConsoleTitle("Debug Window");
SetConsoleTitle(fname);
__hStdOut = GetStdHandle(STD_OUTPUT_HANDLE);
COORD co = {width,height};
SetConsoleScreenBufferSize(__hStdOut, co);
SMALL_RECT coo = {0,0, (width - 1),50}; // Top, left, right, bottom
SetConsoleWindowInfo(__hStdOut, TRUE, &coo);
#endif
if(fname)
{
// Edit the log file name
std::string FileEnding = ".log";
std::string FileName = fname;
std::string FullFilename = (FileName + FileEnding);
__fStdOut = fopen(FullFilename.c_str(), "w");
}
#endif
}
// Use wprintf like TRACE0, TRACE1, ... (The arguments are the same as printf)
//int wprintf(char *fmt, ...)
int wprintf(char *fmt, ...)
{
#ifdef MM_DEBUG
char s[300];
va_list argptr;
int cnt;
va_start(argptr, fmt);
cnt = vsprintf(s, fmt, argptr);
va_end(argptr);
DWORD cCharsWritten;
// ---------------------------------------------------------------------------------------
#ifndef MM_DEBUG_FILEONLY
if(__hStdOut)
{
WriteConsole(__hStdOut, s, strlen(s), &cCharsWritten, NULL);
}
#endif
// ---------------------------------------------------------------------------------------
if(__fStdOut)
{
fprintf(__fStdOut, s);
fflush(__fStdOut); // Write file now
}
return(cnt);
#else
return 0;
#endif
}
+26
View File
@@ -0,0 +1,26 @@
// Copyright (C) 2003-2008 Dolphin Project.
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, version 2.0.
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License 2.0 for more details.
// A copy of the GPL 2.0 should have been included with the program.
// If not, see http://www.gnu.org/licenses/
// Official SVN repository and contact information can be found at
// http://code.google.com/p/dolphin-emu/
//////////////////////////////////////////////////////////////////////////////////////////
// Declarations and definitions
// ¯¯¯¯¯¯¯¯¯¯
void StartConsoleWin(int width, int height, char* fname);
int wprintf(char *fmt, ...);
//////////////////////////////////
+40
View File
@@ -0,0 +1,40 @@
[Plainamp]
OutputPluginActive___out_ds.dll=1
Volume=255
Loop=1
WinPlaceConsole=(1,(62,441,1179,845))
WinPlaceMain=(1,(274,203,1005,765))
MinimizeToTray=1
Panning=0
CurPresetFixed=-1
PreventDistortion=1
Order=3
PlaylistFollow=1
PlaylistEntryNumberZeroPadding=1
CurPlaylistPosition=0
InfinitePlaylist=0
ManagerGrid=1
WinPlaceManager=(1,(500,400,1000,700))
OrderBand=(0,-2,0,1)
EqBand=(1,-2,0,1)
SeekBand=(2,-2,0,1)
VolBand=(3,-2,0,1)
PanBand=(4,-2,0,1)
ButtonsBand=(5,134,0,1)
VisBand=(6,134,0,1)
InvertPanSlider=0
CurDir=C:\
WarnPluginsMissing=1
[out_wave_gpl]
config=14000000002400000100000000000000FFFFFFFF0100000036
[out_ds]
cfg_hw_mix=1
cfg_buf_ms=2000
cfg_trackhack=0
cfg_prebuf2=500
cfg_fade_seek.on=0
cfg_fade_pause.on=0
cfg_fadevol=0
cfg_wait=0
[Interface]
ShowConsole = False
Binary file not shown.
+29
View File
@@ -0,0 +1,29 @@
[Plainamp]
OutputPluginActive___out_wave_gpl.dll=1
Volume=100
Loop=1
WinPlaceConsole=(1,(62,441,1179,845))
WinPlaceMain=(1,(274,203,1005,765))
MinimizeToTray=1
Panning=0
CurPresetFixed=-1
PreventDistortion=1
Order=3
PlaylistFollow=1
PlaylistEntryNumberZeroPadding=1
CurPlaylistPosition=0
InfinitePlaylist=1
ManagerGrid=1
WinPlaceManager=(1,(500,400,1000,700))
OrderBand=(0,-2,0,1)
EqBand=(1,-2,0,1)
SeekBand=(2,-2,0,1)
VolBand=(3,-2,0,1)
PanBand=(4,-2,0,1)
ButtonsBand=(5,134,0,1)
VisBand=(6,134,0,1)
InvertPanSlider=0
CurDir=C:\
WarnPluginsMissing=1
[out_wave_gpl]
config=14000000002400000100000000000000FFFFFFFF0100000036
+294
View File
@@ -0,0 +1,294 @@
<?xml version="1.0" encoding="Windows-1252"?>
<VisualStudioProject
ProjectType="Visual C++"
Version="9,00"
Name="Main"
ProjectGUID="{95CCAABC-7062-47C4-B8C1-A064DD5F16FF}"
RootNamespace="MusicMod"
TargetFrameworkVersion="196613"
>
<Platforms>
<Platform
Name="Win32"
/>
<Platform
Name="x64"
/>
</Platforms>
<ToolFiles>
</ToolFiles>
<Configurations>
<Configuration
Name="Debug|Win32"
OutputDirectory="$(SolutionDir)$(ConfigurationName)"
IntermediateDirectory="$(ConfigurationName)"
ConfigurationType="4"
CharacterSet="2"
>
<Tool
Name="VCPreBuildEventTool"
/>
<Tool
Name="VCCustomBuildTool"
/>
<Tool
Name="VCXMLDataGeneratorTool"
/>
<Tool
Name="VCWebServiceProxyGeneratorTool"
/>
<Tool
Name="VCMIDLTool"
/>
<Tool
Name="VCCLCompilerTool"
Optimization="0"
AdditionalIncludeDirectories="..\..\..\Source\Core\Common\Src;..\..\..\Externals\wxWidgets\Include;..\..\..\Externals\wxWidgets\Include\msvc;..\..\..\Source\Core\Core\Src"
PreprocessorDefinitions="_SECURE_SCL=0"
MinimalRebuild="true"
BasicRuntimeChecks="3"
RuntimeLibrary="0"
WarningLevel="3"
DebugInformationFormat="4"
/>
<Tool
Name="VCManagedResourceCompilerTool"
/>
<Tool
Name="VCResourceCompilerTool"
/>
<Tool
Name="VCPreLinkEventTool"
/>
<Tool
Name="VCLibrarianTool"
/>
<Tool
Name="VCALinkTool"
/>
<Tool
Name="VCXDCMakeTool"
/>
<Tool
Name="VCBscMakeTool"
/>
<Tool
Name="VCFxCopTool"
/>
<Tool
Name="VCPostBuildEventTool"
/>
</Configuration>
<Configuration
Name="Debug|x64"
OutputDirectory="$(SolutionDir)$(PlatformName)\$(ConfigurationName)"
IntermediateDirectory="$(PlatformName)\$(ConfigurationName)"
ConfigurationType="4"
CharacterSet="2"
>
<Tool
Name="VCPreBuildEventTool"
/>
<Tool
Name="VCCustomBuildTool"
/>
<Tool
Name="VCXMLDataGeneratorTool"
/>
<Tool
Name="VCWebServiceProxyGeneratorTool"
/>
<Tool
Name="VCMIDLTool"
TargetEnvironment="3"
/>
<Tool
Name="VCCLCompilerTool"
Optimization="0"
AdditionalIncludeDirectories="..\..\..\Source\Core\Common\Src;..\..\..\Externals\wxWidgets\Include;..\..\..\Externals\wxWidgets\Include\msvc;..\..\..\Source\Core\Core\Src"
PreprocessorDefinitions="_SECURE_SCL=0"
MinimalRebuild="true"
BasicRuntimeChecks="3"
RuntimeLibrary="3"
WarningLevel="3"
DebugInformationFormat="3"
/>
<Tool
Name="VCManagedResourceCompilerTool"
/>
<Tool
Name="VCResourceCompilerTool"
/>
<Tool
Name="VCPreLinkEventTool"
/>
<Tool
Name="VCLibrarianTool"
/>
<Tool
Name="VCALinkTool"
/>
<Tool
Name="VCXDCMakeTool"
/>
<Tool
Name="VCBscMakeTool"
/>
<Tool
Name="VCFxCopTool"
/>
<Tool
Name="VCPostBuildEventTool"
/>
</Configuration>
<Configuration
Name="Release|Win32"
OutputDirectory="$(SolutionDir)$(ConfigurationName)"
IntermediateDirectory="$(ConfigurationName)"
ConfigurationType="4"
CharacterSet="2"
WholeProgramOptimization="1"
>
<Tool
Name="VCPreBuildEventTool"
/>
<Tool
Name="VCCustomBuildTool"
/>
<Tool
Name="VCXMLDataGeneratorTool"
/>
<Tool
Name="VCWebServiceProxyGeneratorTool"
/>
<Tool
Name="VCMIDLTool"
/>
<Tool
Name="VCCLCompilerTool"
Optimization="2"
EnableIntrinsicFunctions="true"
AdditionalIncludeDirectories="..\..\..\Source\Core\Common\Src;..\..\..\Externals\wxWidgets\Include;..\..\..\Externals\wxWidgets\Include\msvc;..\..\..\Source\Core\Core\Src"
PreprocessorDefinitions="_SECURE_SCL=0"
RuntimeLibrary="0"
EnableFunctionLevelLinking="true"
WarningLevel="3"
DebugInformationFormat="3"
/>
<Tool
Name="VCManagedResourceCompilerTool"
/>
<Tool
Name="VCResourceCompilerTool"
/>
<Tool
Name="VCPreLinkEventTool"
/>
<Tool
Name="VCLibrarianTool"
AdditionalOptions="/NODEFAULTLIB:msvcrt"
/>
<Tool
Name="VCALinkTool"
/>
<Tool
Name="VCXDCMakeTool"
/>
<Tool
Name="VCBscMakeTool"
/>
<Tool
Name="VCFxCopTool"
/>
<Tool
Name="VCPostBuildEventTool"
/>
</Configuration>
<Configuration
Name="Release|x64"
OutputDirectory="$(SolutionDir)$(PlatformName)\$(ConfigurationName)"
IntermediateDirectory="$(PlatformName)\$(ConfigurationName)"
ConfigurationType="4"
CharacterSet="2"
WholeProgramOptimization="1"
>
<Tool
Name="VCPreBuildEventTool"
/>
<Tool
Name="VCCustomBuildTool"
/>
<Tool
Name="VCXMLDataGeneratorTool"
/>
<Tool
Name="VCWebServiceProxyGeneratorTool"
/>
<Tool
Name="VCMIDLTool"
TargetEnvironment="3"
/>
<Tool
Name="VCCLCompilerTool"
Optimization="2"
EnableIntrinsicFunctions="true"
AdditionalIncludeDirectories="..\..\..\Source\Core\Common\Src;..\..\..\Externals\wxWidgets\Include;..\..\..\Externals\wxWidgets\Include\msvc;..\..\..\Source\Core\Core\Src"
PreprocessorDefinitions="_SECURE_SCL=0"
RuntimeLibrary="0"
EnableFunctionLevelLinking="true"
WarningLevel="3"
DebugInformationFormat="3"
/>
<Tool
Name="VCManagedResourceCompilerTool"
/>
<Tool
Name="VCResourceCompilerTool"
/>
<Tool
Name="VCPreLinkEventTool"
/>
<Tool
Name="VCLibrarianTool"
AdditionalOptions="/NODEFAULTLIB:msvcrt"
/>
<Tool
Name="VCALinkTool"
/>
<Tool
Name="VCXDCMakeTool"
/>
<Tool
Name="VCBscMakeTool"
/>
<Tool
Name="VCFxCopTool"
/>
<Tool
Name="VCPostBuildEventTool"
/>
</Configuration>
</Configurations>
<References>
</References>
<Files>
<File
RelativePath=".\Src\Frame.cpp"
>
</File>
<File
RelativePath=".\Src\Main.cpp"
>
</File>
<File
RelativePath=".\Src\Main.h"
>
</File>
<File
RelativePath=".\Src\Setup.h"
>
</File>
</Files>
<Globals>
</Globals>
</VisualStudioProject>
+454
View File
@@ -0,0 +1,454 @@
// Copyright (C) 2003-2008 Dolphin Project.
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, version 2.0.
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License 2.0 for more details.
// A copy of the GPL 2.0 should have been included with the program.
// If not, see http://www.gnu.org/licenses/
// Official SVN repository and contact information can be found at
// http://code.google.com/p/dolphin-emu/
//////////////////////////////////////////////////////////////////////////////////////////
// Include
// ¯¯¯¯¯¯¯¯¯¯
#include <iostream> // System
#include "Core.h" // Core
#include "IniFile.h" // Common
#include "../../../../Source/Core/DolphinWX/Src/Globals.h" // DolphinWX
#include "../../../../Source/Core/DolphinWX/Src/Frame.h"
#include "../../Common/Console.h" // Local
#include "../../Player/Src/PlayerExport.h" // Player
//////////////////////////////////
//////////////////////////////////////////////////////////////////////////////////////////
// Declarations and definitions
// ¯¯¯¯¯¯¯¯¯¯
namespace MusicMod
{
bool GlobalMute = false;
bool GlobalPause = false;
bool bShowConsole = false;
int GlobalVolume = 255;
extern bool dllloaded;
}
//////////////////////////////////
//////////////////////////////////////////////////////////////////////////////////////////
// Change the brightness of a wxBitmap
// ¯¯¯¯¯¯¯¯¯¯
wxBitmap SetBrightness(wxBitmap _Bitmap, int _Brightness, bool Gray)
{
wxImage _Image = _Bitmap.ConvertToImage();
wxImage _Image2 = _Bitmap.ConvertToImage();
wxString Tmp;
if(_Brightness < 0) _Brightness = 0; // Limits
if(_Brightness > 255) _Brightness = 255;
_Brightness = 255 - _Brightness; // Make big values brighter
// Remove the alpha layer first
for(int y = 0; y < _Bitmap.GetWidth(); y++)
{
for(int x = 0; x < _Bitmap.GetHeight(); x++)
_Image.SetAlpha(x, y, 255);
}
for(int y = 0; y < _Bitmap.GetWidth(); y++)
{
//Tmp += wxString::Format("\n %i: ", y);
for(int x = 0; x < _Bitmap.GetHeight(); x++)
{
u8 R = _Image.GetRed(x, y); // Get colors
u8 G = _Image.GetGreen(x, y);
u8 B = _Image.GetBlue(x, y);
//if((x == 5 | x == 6) && y == 15) Tmp += wxString::Format("%03i %03i %03i", R, G, B);
if(_Brightness > 128)
{
int Bright = _Brightness - 128;
R = R - Bright * (R - 0) / 128;
G = G - Bright * (G - 0) / 128;
B = B - Bright * (B - 0) / 128;
// 118 - 72 * 118 / 128 = 118 - 66.3 = 52
// 119 - = 119 - 66.9 = 52
}
else
{
int Bright = 128 - _Brightness;
R = R - Bright * (R - 255) / 128;
G = G - Bright * (G - 255) / 128;
B = B - Bright * (B - 255) / 128;
}
//if((x == 5 | x == 6) && y == 15) Tmp += wxString::Format(" %03i %03i %03i | ", R, G, B);
_Image.SetRGB(x, y, R, G, B);
}
}
// Return the alpha
_Image.SetAlpha(_Image2.GetAlpha(), true);
// Update the bitmap
if(Gray)
return wxBitmap(_Image.ConvertToGreyscale());
else
return wxBitmap(_Image);
//wxMessageBox(Tmp);
}
//////////////////////////////////
void ShowConsole()
{
StartConsoleWin(100, 2000, "Console"); // Give room for 2000 rows
}
#ifdef MUSICMOD
void
CFrame::MM_InitBitmaps()
{
// Gray version
//m_Bitmaps[Toolbar_PluginDSP_Dis] = wxBitmap(SetBrightness(m_Bitmaps[Toolbar_PluginDSP], 165, true));
m_Bitmaps[Toolbar_PluginDSP_Dis] = wxBitmap(SetBrightness(m_Bitmaps[Toolbar_PluginDSP], 165, true));
m_Bitmaps[Toolbar_Log_Dis] = wxBitmap(SetBrightness(m_Bitmaps[Toolbar_Log], 165, true));
}
void
CFrame::MM_PopulateGUI()
{
// ---------------------------------------
// Load config
// ---------------------
IniFile file;
file.Load("Plainamp.ini");
file.Get("Interface", "ShowConsole", &MusicMod::bShowConsole, false);
// -------
// ---------------------------------------
// Make a debugging window
// ---------------------
if(MusicMod::bShowConsole) ShowConsole();
// Write version
#ifdef _M_X64
wprintf("64 bit version\n");
#else
wprintf("32 bit version\n");
#endif
// -----------
wxToolBar* toolBar = theToolBar; // Shortcut
toolBar->AddSeparator();
// ---------------------------------------
// Draw a rotated music label
// ---------------------
wxBitmap m_RotatedText(30, 15);
wxMemoryDC dc;
dc.SelectObject(m_RotatedText);
wxBrush BackgroundGrayBrush(_T("#ece9d8")); // The right color in windows
// Set outline and fill colors
dc.SetBackground(BackgroundGrayBrush);
dc.Clear();
wxFont m_font(8, wxFONTFAMILY_DEFAULT, wxFONTSTYLE_NORMAL, wxFONTWEIGHT_BOLD);
dc.SetFont(m_font);
dc.SetTextForeground(wxColour(*wxLIGHT_GREY));
dc.DrawText(wxT("Music"), 0, 0);
m_RotatedText = wxBitmap(m_RotatedText.ConvertToImage().Rotate90(false));
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_Play], _T("Mute music"));
mm_ToolPlay = toolBar->AddTool(IDM_MUSIC_PLAY, _T("Play"), m_Bitmaps[Toolbar_Play], _T("Play or pause music without pausing the game"));
// This cause the disabled tool bitmap to become some kind of monochrome version
/*
mm_ToolMute = new wxToolBarToolBase(toolBar, IDM_MUTE, _T("Mute"), m_Bitmaps[Toolbar_PluginDSP],
m_Bitmaps[Toolbar_PluginDSP], wxITEM_CHECK, 0, _T("Mute music"));
toolBar->AddTool(mm_ToolMute);
mm_ToolPlay = new wxToolBarToolBase(toolBar, IDM_MUSIC_PLAY, _T("Play"), m_Bitmaps[Toolbar_Play],
m_Bitmaps[Toolbar_Play], wxITEM_NORMAL, 0, _T("Play or pause music without pausing the game"));
toolBar->AddTool(mm_ToolPlay);
*/
// ---------------------
/* 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);
wxSlider * mm_Slider = new wxSlider(mm_SliderPanel, IDS_VOLUME, 125, 0, 255, wxDefaultPosition, wxDefaultSize);
//m_Slider->SetToolTip("Change the music volume");
wxStaticText * mm_SliderText = new wxStaticText(mm_SliderPanel, IDS_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);
mm_SliderPanel->SetSizer(mm_VolSizer);
mm_SliderPanel->SetSize(mm_VolSizer->GetMinSize().GetWidth(), mm_VolSizer->GetMinSize().GetHeight());
toolBar->AddControl((wxControl*)mm_SliderPanel);
// ---------
mm_ToolLog = toolBar->AddTool(IDT_LOG, _T("Log"), m_Bitmaps[Toolbar_Log], _T("Show or hide log"));
}
void
CFrame::MM_UpdateGUI()
{
// ---------------------------------------------------------------------------------------
if(MusicMod::GlobalMute)
{
//m_pMenuItemMute->SetText(_T("Play"));
//GetToolBar()->SetToolNormalBitmap(IDM_MUTE, m_Bitmaps[Toolbar_Pause]);
mm_ToolMute->SetLabel("Unmute");
mm_ToolMute->SetNormalBitmap(m_Bitmaps[Toolbar_PluginDSP_Dis]);
//m_ToolMute->SetToggle(true);
}
else
{
//GetToolBar()->SetToolNormalBitmap(IDM_MUTE, m_Bitmaps[Toolbar_PluginDSP]);
mm_ToolMute->SetLabel("Mute");
mm_ToolMute->SetNormalBitmap(m_Bitmaps[Toolbar_PluginDSP]);
}
if(MusicMod::GlobalPause)
{
//GetToolBar()->SetToolNormalBitmap(IDM_PAUSE, m_Bitmaps[Toolbar_Pause]);
mm_ToolPlay->SetLabel("Play");
mm_ToolPlay->SetNormalBitmap(m_Bitmaps[Toolbar_Play]);
}
else
{
//GetToolBar()->SetToolNormalBitmap(IDM_PAUSE, m_Bitmaps[Toolbar_PluginDSP]);
mm_ToolPlay->SetLabel("Pause");
mm_ToolPlay->SetNormalBitmap(m_Bitmaps[Toolbar_Pause]);
}
if(MusicMod::bShowConsole)
{
mm_ToolLog->SetNormalBitmap(m_Bitmaps[Toolbar_Log]);
}
else
{
mm_ToolLog->SetNormalBitmap(m_Bitmaps[Toolbar_Log_Dis]);
}
// ---------------------------------------------------------------------------------------
}
void
CFrame::MM_OnPlay()
{
//MessageBox(0, "CFrame::OnPlay > Begin", "", 0);
wprintf("\nCFrame::OnPlayMusicMod > Begin\n");
if (Core::GetState() != Core::CORE_UNINITIALIZED)
{
if (Core::GetState() == Core::CORE_RUN)
{
wprintf("CFrame::OnPlayMusicMod > Pause\n");
if(!MusicMod::GlobalPause) // we may has set this elsewhere
{
MusicMod::GlobalPause = true;
if (MusicMod::dllloaded)
{
Player_Pause();
}
}
}
else
{
wprintf("CFrame::OnPlayMusicMod > Play\n");
if(MusicMod::GlobalPause) // we may has set this elsewhere
{
MusicMod::GlobalPause = false;
if (MusicMod::dllloaded)
{
Player_Unpause();
}
}
}
}
}
// =======================================================================================
// Mute music
// ---------------------------------------------------------------------------------------
void
CFrame::MM_OnMute(wxCommandEvent& WXUNUSED (event))
{
wprintf("CFrame::OnMute > Begin\n");
//MessageBox(0, "", "", 0);
if(!MusicMod::GlobalMute)
{
if(MusicMod::dllloaded) // avoid crash
{
Player_Mute();
}
MusicMod::GlobalMute = true;
//m_ToolMute->Enable(false);
//GetToolBar()->EnableTool(IDT_LOG, false);
UpdateGUI();
}
else
{
if(MusicMod::dllloaded) // avoid crash
{
Player_Mute();
}
MusicMod::GlobalMute = false;
//m_ToolMute->Enable(true);
UpdateGUI();
}
}
// =======================================================================================
// =======================================================================================
// Pause music
// ---------------------------------------------------------------------------------------
void
CFrame::MM_OnPause(wxCommandEvent& WXUNUSED (event))
{
wprintf("CFrame::OnPause > Begin\n");
//MessageBox(0, "", "", 0);
if(!MusicMod::GlobalPause)
{
if(MusicMod::dllloaded) // avoid crash
{
Player_Pause();
}
MusicMod::GlobalPause = true;
UpdateGUI();
}
else
{
if(MusicMod::dllloaded) // avoid crash
{
Player_Pause();
}
MusicMod::GlobalPause = false;
UpdateGUI();
}
}
// =======================================================================================
// Change volume
// ---------------------------------------------------------------------------------------
void CFrame::MM_OnVolume(wxScrollEvent& event)
{
//wprintf("CFrame::OnVolume > Begin <%i>\n", event.GetPosition());
//MessageBox(0, "", "", 0);
//if(event.GetEventType() == wxEVT_SCROLL_PAGEUP || event.GetEventType() == wxEVT_SCROLL_PAGEDOWN)
// return;
if(MusicMod::dllloaded) // avoid crash
{
Player_Volume(event.GetPosition());
MusicMod::GlobalVolume = event.GetPosition();
MusicMod::GlobalMute = false; // Unmute to
mm_ToolMute->Toggle(false);
if(event.GetEventType() == wxEVT_SCROLL_CHANGED)
{
// Only update this on release, to avoid major flickering when changing volume
UpdateGUI();
/* Use this to avoid that the focus get stuck on the slider when the main
window has been replaced */
this->SetFocus();}
}
}
//=======================================================================================
// =======================================================================================
// Show log
// ---------------------------------------------------------------------------------------
void CFrame::MM_OnLog(wxCommandEvent& event)
{
//wprintf("CFrame::OnLog > Begin\n");
//MessageBox(0, "", "", 0);
if(MusicMod::dllloaded) // Avoid crash
{
}
MusicMod::bShowConsole = !MusicMod::bShowConsole;
if(MusicMod::bShowConsole)
{ ShowConsole(); Player_Console(true); }
else
{
#if defined (_WIN32)
FreeConsole(); Player_Console(false);
#endif
}
IniFile file;
file.Load("Plainamp.ini");
file.Set("Interface", "ShowConsole", MusicMod::bShowConsole);
file.Save("Plainamp.ini");
UpdateGUI();
}
//=======================================================================================
#endif // MUSICMOD
+283
View File
@@ -0,0 +1,283 @@
// Copyright (C) 2003-2008 Dolphin Project.
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, version 2.0.
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License 2.0 for more details.
// A copy of the GPL 2.0 should have been included with the program.
// If not, see http://www.gnu.org/licenses/
// Official SVN repository and contact information can be found at
// http://code.google.com/p/dolphin-emu/
//////////////////////////////////////////////////////////////////////////////////////////
// Include
// ¯¯¯¯¯¯¯¯¯¯
#include <iostream>
#include <vector>
#include <string>
#include <windows.h>
#include "PowerPC/PowerPc.h" // Core
#include "../../../../Source/Core/DiscIO/Src/FileSystemGCWii.h" // This file has #include "Filesystem.h"
#include "../../../../Source/Core/DiscIO/Src/VolumeCreator.h"
#include "../../Player/Src/PlayerExport.h" // Local player
#include "../../Common/Console.h" // Local common
//////////////////////////////////
//////////////////////////////////////////////////////////////////////////////////////////
// Declarations and definitions
// ¯¯¯¯¯¯¯¯¯¯
namespace MusicMod
{
struct MyFilesStructure
{
std::string path;
int offset; // Is int enough, how high does offset go?
};
std::vector <MyFilesStructure> MyFiles;
void StructSort (std::vector <MyFilesStructure> &MyFiles);
// Playback
std::string currentfile;
std::string unique_gameid;
std::string MusicPath;
DiscIO::CFileSystemGCWii* my_pFileSystem;
extern bool bShowConsole;
int WritingFile = false;
bool dllloaded = false;
std::string CurrentPlayFile;
//////////////////////////////////
// ---------------------------------------------------------------------------------------
// A function to sort the filelist table after offset
void StructSort (std::vector <MyFilesStructure> &MyFiles)
{
MyFilesStructure temp;
//wprintf("StructSort > Begin\n");
for(int i = 0; i < MyFiles.size() - 1; i++)
{
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
MyFiles[ i ] = MyFiles[ j ];
MyFiles[ j ] = temp;
}
}
}
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";
}
//wprintf("StructSort > Done\n");
}
// =======================================================================================
/* This will load Plainamp.dll. It's the original Plainamp.exe with removed GUI and some small
modifications. */
void Main(std::string FileName)
{
//
DiscIO::IVolume* pVolume = DiscIO::CreateVolumeFromFilename(FileName.c_str());
//
my_pFileSystem = new DiscIO::CFileSystemGCWii(pVolume);
/* 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
to a new vetor first. */
MyFiles.resize(my_pFileSystem->m_FileInfoVector.size()); // Set size
for (size_t i = 0; i < my_pFileSystem->m_FileInfoVector.size(); i++)
{
MyFiles.at(i).offset = my_pFileSystem->m_FileInfoVector.at(i).m_Offset;
MyFiles.at(i).path = my_pFileSystem->m_FileInfoVector.at(i).m_FullPath;
}
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
//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\\";
wprintf("Created a Music directory\n");
CreateDirectory(MusicPath.c_str(), attr);
// ----------------------------------------------------------------------------------------
}
// =======================================================================================
// Supported music files
// ---------------------------------------------------------------------------------------
bool CheckFileEnding(std::string FileName)
{
if (
(FileName.find(".adp") != std::string::npos) // 1080 Avalanche, Crash Bandicoot etc
|| (FileName.find(".afc") != std::string::npos) // Zelda WW
|| (FileName.find(".ast") != std::string::npos) // Zelda TP, Mario Kart
|| (FileName.find(".dsp") != std::string::npos) // Metroid Prime
|| (FileName.find(".hps") != std::string::npos) // SSB Melee
)
return true;
}
// =======================================================================================
// =======================================================================================
//
void CheckFile(u64 offset, u64 size)
{
// =======================================================================================
/* Only do this test:
1. After boot, not on ISO scan
2. Not if offset = 0.
3. Not when WritingFile. We will lead to calls back to here (Read) and it will mess
upp the scanning */
if(PowerPC::state == 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
specify (MyFiles.size() - 1) because we will be reading MyFiles.at(i + 1).
MyFiles.size() is the amount of files on the disc, and the last file is
MyFiles.at(MyFiles.size() - 1) */
// ---------------------------------------------------------------------------------------
for (int i = 0; i < (int)(MyFiles.size() - 1); ++i)
{
// ---------------------------------------------------------------------------------------
/* If we assume that myoffset is the begginning of every file this works.
Suppose there are three files
1 is 0 to 149
2 is 150 to 170
3 is 171 to 200
If the offset is 160 the game is reading file number two, for example
myoffset = 150: (myoffset >= offset) == false
myoffset = 171: (myoffset >= offset) == true, break
However if the offset is 195 the game is reading the last file and we will get
myoffset = 171: (myoffset >= offset) == false
we therefore need to add the condition (offset > MyFiles[MyFiles.size() - 1].offset)
to. */
if (MyFiles[i + 1].offset >= offset || offset > MyFiles[MyFiles.size() - 1].offset)
{
// Now we know that the game is reading from MyFiles[i].path
// Break if we found the same file again
if (currentfile == MyFiles[i].path) break;
//wprintf(">>>> (%i)Current read %s <%u = %ux%i> <block %u>\n", i, CurrentFiles[i].path.c_str(), offset, CurrentFiles[i].offset, size);
if (CheckFileEnding(MyFiles[i].path.c_str()))
{
//u64 myoffset2 = (u32)offset;
wprintf("\n >>> (%i/%i) Match %s <%u = %ux%i> <block %u>\n\n", i,
MyFiles.size(), MyFiles[i].path.c_str(), offset, MyFiles[i].offset, size);
//wprintf(">>>> [i + 1].offset %i", MyFiles[i + 1].offset);
currentfile = MyFiles[i].path; // save the found file
// ---------------------------------------------------------------------------------------
// We will now save the file to the PC hard drive
// ---------------------------------------------------------------------------------------
// Get the filename
std::size_t pointer = MyFiles[i].path.find_last_of("\\");
std::string fragment = MyFiles[i].path.substr (0, (pointer-0));
int compare = MyFiles[i].path.length() - fragment.length(); // get the length of the filename
fragment = MyFiles[i].path.substr ((pointer+1), compare); // now we have the filename
// ---------------------------------------------------------------------------------------
// Create the file path
std::string FilePath = (MusicPath + fragment);
// ---------------------------------------------------------------------------------------
WritingFile = true; // Avoid detecting the file we are writing
wprintf("Writing <%s> to <%s>\n", MyFiles[i].path.c_str(), FilePath.c_str());
my_pFileSystem->ExportFile(MyFiles[i].path.c_str(), FilePath.c_str());
WritingFile = false;
// ---------------------------------------------------------------------------------------
// Play the file we found
if(dllloaded)
{
Player_Play((char*)FilePath.c_str()); // retype it from const char* to char*
} else {
wprintf("Warning > Music DLL is not loaded");
}
// ---------------------------------------------------------------------------------------
// Remove the last file, if any
if(CurrentPlayFile.length() > 0)
{
if(!remove(CurrentPlayFile.c_str()))
{
wprintf("The program failed to remove <%s>\n", CurrentPlayFile.c_str());
} else {
wprintf("The program removed <%s>\n", CurrentPlayFile.c_str());
}
}
// ---------------------------------------------------------------------------------------
// Save the current playing file
CurrentPlayFile = FilePath; // Save the filename so we can remove it later
break;
// ---------------------------------------------------------------------------------------
}
// ---------------------------------------------------------------------------------------
// Tell about the files we ignored
wprintf("(%i/%i) Ignored %s <%u = %ux%i> <block %u>\n", i, MyFiles.size(), MyFiles[i].path.c_str(), offset, MyFiles[i].offset, size);
currentfile = MyFiles[i].path;
break;
// ---------------------------------------------------------------------------------------
}
}
//wprintf("Blob.cpp:Read <%i> <%i> <%i> <%i>\n", offset, size, out_ptr);
} // This ends the entire filescan
// =======================================================================================
}
} // end of namespace
+31
View File
@@ -0,0 +1,31 @@
// Copyright (C) 2003-2008 Dolphin Project.
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, version 2.0.
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License 2.0 for more details.
// A copy of the GPL 2.0 should have been included with the program.
// If not, see http://www.gnu.org/licenses/
// Official SVN repository and contact information can be found at
// http://code.google.com/p/dolphin-emu/
#include <iostream> // System: For std
#include "Common.h" // Common: For u64
namespace MusicMod
{
void Main(std::string FileName);
void CheckFile(u64 offset, u64 size);
}
+23
View File
@@ -0,0 +1,23 @@
// Copyright (C) 2003-2008 Dolphin Project.
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, version 2.0.
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License 2.0 for more details.
// A copy of the GPL 2.0 should have been included with the program.
// If not, see http://www.gnu.org/licenses/
// Official SVN repository and contact information can be found at
// http://code.google.com/p/dolphin-emu/
////////////////////////////////////////////////////////////////////////////////////////
// Build with music modification
// ¯¯¯¯¯¯¯¯¯
#define MUSICMOD
//////////////////////////
+83 -15
View File
@@ -34,6 +34,10 @@ ConfVar::ConfVar( TCHAR * szKey, ConfMode mode )
{
// MessageBox( 0, TEXT( "no const @ ConfVar" ), TEXT( "" ), 0 );
// ---------------------------------------------------------------------------------------
//wprintf("ConfVar::ConfVar(TCHAR) > Got <%s>\n", szKey);
// ---------------------------------------------------------------------------------------
// Init
const int iLen = ( int )_tcslen( szKey );
m_szKey = new TCHAR[ iLen + 1 ];
@@ -57,6 +61,10 @@ ConfVar::ConfVar( TCHAR * szKey, ConfMode mode )
////////////////////////////////////////////////////////////////////////////////
ConfVar::ConfVar( const TCHAR * szKey, ConfMode mode )
{
// ---------------------------------------------------------------------------------------
//wprintf("ConfVar::ConfVar(const TCHAR) > Got <%s>\n", szKey);
// ---------------------------------------------------------------------------------------
// Init
m_szKey = ( TCHAR * )szKey;
@@ -68,6 +76,11 @@ ConfVar::ConfVar( const TCHAR * szKey, ConfMode mode )
// Register
if( !conf_map ) conf_map = new map<TCHAR *, ConfVar *>;
conf_map->insert( pair<TCHAR *, ConfVar *>( m_szKey, this ) );
// ---------------------------------------------------------------------------------------
//wprintf("ConfVar::ConfVar(const TCHAR) > Insert <%s>\n", ConfVar::m_szKey);
// ---------------------------------------------------------------------------------------
}
@@ -82,6 +95,8 @@ ConfVar::~ConfVar()
// =======================================================================================
// The line name is collected in ConfVar, then ConfBool gets the boolean
////////////////////////////////////////////////////////////////////////////////
///
////////////////////////////////////////////////////////////////////////////////
@@ -89,11 +104,16 @@ ConfBool::ConfBool( bool * pbData, TCHAR * szKey, ConfMode mode, bool bDefault )
{
// MessageBox( 0, TEXT( "no const @ ConfBool" ), TEXT( "" ), 0 );
// ---------------------------------------------------------------------------------------
wprintf("ConfBool(TCHAR) > Get <%s>\n", szKey);
// ---------------------------------------------------------------------------------------
m_pbData = pbData;
m_bDefault = bDefault;
// *pbData = bDefault;
}
// =======================================================================================
@@ -102,6 +122,10 @@ ConfBool::ConfBool( bool * pbData, TCHAR * szKey, ConfMode mode, bool bDefault )
////////////////////////////////////////////////////////////////////////////////
ConfBool::ConfBool( bool * pbData, const TCHAR * szKey, ConfMode mode, bool bDefault ) : ConfVar( szKey, mode )
{
// ---------------------------------------------------------------------------------------
wprintf("ConfBool(TCHAR) > Get <%s>\n", szKey);
// ---------------------------------------------------------------------------------------
m_pbData = pbData;
m_bDefault = bDefault;
@@ -115,6 +139,8 @@ ConfBool::ConfBool( bool * pbData, const TCHAR * szKey, ConfMode mode, bool bDef
////////////////////////////////////////////////////////////////////////////////
void ConfBool::Read()
{
wprintf("ConfBool::Read() > Begin <m_bRead:%i> and <szIniPath:%s>\n", m_bRead, szIniPath);
if( m_bRead || !szIniPath ) return;
*m_pbData = ( GetPrivateProfileInt( SECTION, m_szKey, ( int )m_bDefault, szIniPath ) != 0 );
@@ -493,22 +519,31 @@ ConfString::ConfString( TCHAR * szData, const TCHAR * szKey, ConfMode mode, TCHA
////////////////////////////////////////////////////////////////////////////////
void ConfString::Read()
{
wprintf( "ConfString::Read() > Begin\n");
if( m_bRead || !szIniPath ) return;
GetPrivateProfileString( SECTION, m_szKey, m_szDefault, m_szData, m_iMaxLen, szIniPath );
wprintf( "ConfString::Read() > GetPrivateProfileString <%s> <%s> <%s>\n", m_szKey, m_szData, szIniPath);
m_bRead = true;
}
// =======================================================================================
// I don't use this
////////////////////////////////////////////////////////////////////////////////
///
////////////////////////////////////////////////////////////////////////////////
void ConfString::Write()
{
/*
WritePrivateProfileString( SECTION, m_szKey, m_szData, szIniPath );
m_bRead = true;
}
*/
}
// =======================================================================================
@@ -531,7 +566,9 @@ ConfCurDir::ConfCurDir( TCHAR * szData, const TCHAR * szKey ) : ConfString( szDa
}
// =======================================================================================
// MAJOR FUNCTION: This changes the relative path for the whole application
// =======================================================================================
////////////////////////////////////////////////////////////////////////////////
///
////////////////////////////////////////////////////////////////////////////////
@@ -542,9 +579,12 @@ void ConfCurDir::Read()
// MessageBox( 0, m_szData, TEXT( "CurDir" ), 0 );
// Apply
SetCurrentDirectory( m_szData );
}
//SetCurrentDirectory( m_szData );
wprintf("ConfCurDir::Read > End <%s>\n", m_szData);
}
// =======================================================================================
// =======================================================================================
////////////////////////////////////////////////////////////////////////////////
@@ -556,6 +596,7 @@ void ConfCurDir::Write()
GetCurrentDirectory( MAX_PATH, m_szData ); // Note: without trailing slash
// MessageBox( 0, m_szData, TEXT( "CurDir" ), 0 );
//wprintf("ConfCurDir::Read <%s>\n", m_szData);
ConfString::Write();
}
@@ -565,10 +606,12 @@ void ConfCurDir::Write()
////////////////////////////////////////////////////////////////////////////////
///
////////////////////////////////////////////////////////////////////////////////
void Conf::Init( HINSTANCE hInstance )
void Conf::Init()
{
if( szIniPath ) return;
// =======================================================================================
// Find the right ini file
// Long filename
szIniPath = new TCHAR[ _MAX_PATH ];
@@ -578,40 +621,65 @@ void Conf::Init( HINSTANCE hInstance )
TCHAR szDir[ _MAX_DIR ] = TEXT( "" );
GetModuleFileName( hInstance, szFull, _MAX_PATH );
// ---------------------------------------------------------------------------------------
// We place the full path in szFull
//GetModuleFileName( hInstance, szFull, _MAX_PATH );
GetModuleFileName( NULL, szFull, _MAX_PATH ); // No don't use that
// ---------------------------------------------------------------------------------------
_tsplitpath( szFull, szDrive, szDir, NULL, NULL );
// Convert short to long path
GetLongPathName( szDir, szDir, _MAX_DIR );
// ---------------------------------------------------------------------------------------
// We place information about the file in fd
// ---------------------------------------------------------------------------------------
// Convert short to long file
WIN32_FIND_DATA fd;
HANDLE h = FindFirstFile( szFull, &fd );
// ---------------------------------------------------------------------------------------
// ---------------------------------------------------------------------------------------
// Convert File.exe to File.ini
// ---------------------------------------------------------------------------------------
// Search last dot
TCHAR * szSearch = fd.cFileName + _tcslen( fd.cFileName ) - 1;
while( ( *szSearch != TEXT( '.' ) ) && ( szSearch > fd.cFileName ) )
{
szSearch--;
}
// ---------------------------------------------------------------------------------------
// Replace extension
_tcscpy( szSearch, TEXT( ".ini" ) );
// ---------------------------------------------------------------------------------------
// Copy full filename
_sntprintf( szIniPath, _MAX_PATH, TEXT( "%s%s%s" ), szDrive, szDir, fd.cFileName );
//_sntprintf( szIniPath, _MAX_PATH, TEXT( "%s%s%s" ), szDrive, szDir, fd.cFileName );
_sntprintf( szIniPath, _MAX_PATH, TEXT( "%s%s%s" ), szDrive, szDir, TEXT( "Plainamp.ini" ) );
wprintf("DLL > We got the ini path <%s>\n", szIniPath);
// =======================================================================================
// Read all
// ---------------------------------------------------------------------------------------
// Read all settings in it
// ---------------------------------------------------------------------------------------
// Read all (original comment)
map<TCHAR *, ConfVar *>::iterator iter = conf_map->begin();
// =======================================================================================
// *** Something changes the API relative paths here
while( iter != conf_map->end() )
{
iter->second->Read();
iter++;
iter->second->Read(); // *** This changes the relative path
iter++;
}
// =======================================================================================
// ---------------------------------------------------------------------------------------
}
+5 -2
View File
@@ -22,7 +22,8 @@
namespace Conf
{
void Init( HINSTANCE hInstance );
//void Init( HINSTANCE hInstance );
void Init( );
void Write();
};
@@ -71,7 +72,9 @@ protected:
private:
bool m_bCopyKey; ///< Keyname is copy (has to be freed on destruction)
friend void Conf::Init( HINSTANCE hInstance );
//friend void Conf::Init( HINSTANCE hInstance );
friend void Conf::Init( );
friend void Conf::Write();
};
+10 -10
View File
@@ -1,13 +1,13 @@
////////////////////////////////////////////////////////////////////////////////
// Plainamp, Open source Winamp core
//
// Copyright © 2005 Sebastian Pipping <webmaster@hartwork.org>
//
// --> http://www.hartwork.org
//
// This source code is released under the GNU General Public License (GPL).
// See GPL.txt for details. Any non-GPL usage is strictly forbidden.
////////////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////////
// Plainamp, Open source Winamp core
//
// Copyright © 2005 Sebastian Pipping <webmaster@hartwork.org>
//
// --> http://www.hartwork.org
//
// This source code is released under the GNU General Public License (GPL).
// See GPL.txt for details. Any non-GPL usage is strictly forbidden.
////////////////////////////////////////////////////////////////////////////////
#ifndef PA_CONSOLE_H
@@ -145,6 +145,7 @@ bool DspPlugin::Unload()
_stprintf( szBuffer, TEXT( "Unloading <%s>" ), GetFilename() );
Console::Append( szBuffer );
Console::Append( TEXT( " " ) );
printf( ">>>Unloading <%s>\n" , GetFilename() );
header = NULL;
+4 -1
View File
@@ -17,7 +17,10 @@
#include <windows.h>
#include <tchar.h>
// =======================================================================================
// Global declarations
#include "../Global.h"
// =======================================================================================
/*
== TYPE =============================================================================

Some files were not shown because too many files have changed in this diff Show More