Common: Moved Windows console functions to common

git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@1887 8ced0084-cf51-0410-be5f-012b33b47a6e
This commit is contained in:
John Peterson committed 2009-01-17 14:28:09 +00:00
1 parent 7f9ce70b33
commit ae9cfbd8e3
70 files changed
+1337 -2987

No files matched your search

+128 -1
View File
@@ -169,7 +169,7 @@
Optimization="2"
EnableIntrinsicFunctions="true"
AdditionalIncludeDirectories="..\..\..\Source\Core\Common\Src;..\..\..\Externals\wxWidgets\Include;..\..\..\Externals\wxWidgets\Include\msvc;..\..\..\Source\Core\Core\Src"
PreprocessorDefinitions="_SECURE_SCL=0"
PreprocessorDefinitions="NDEBUG;_SECURE_SCL=0"
RuntimeLibrary="0"
EnableFunctionLevelLinking="true"
WarningLevel="3"
@@ -268,6 +268,133 @@
Name="VCPostBuildEventTool"
/>
</Configuration>
<Configuration
Name="DebugFast|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="NDEBUG;DEBUGFAST;_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="DebugFast|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>
+9 -9
View File
@@ -24,6 +24,7 @@
#include "Core.h" // Core
#include "IniFile.h" // Common
#include "ConsoleWindow.h"
#include "../../../../Source/Core/DolphinWX/Src/Globals.h" // DolphinWX
#include "../../../../Source/Core/DolphinWX/Src/Frame.h"
@@ -34,7 +35,6 @@
#include "../../../../Source/Core/DolphinWX/resources/KDE.h"
#include "../../../../Source/Core/DolphinWX/resources/X-Plastik.h"
#include "../../Common/Src/Console.h" // Local
#include "../../Player/Src/PlayerExport.h" // Player
//////////////////////////////////
@@ -282,7 +282,7 @@ CFrame::MM_UpdateGUI()
void
CFrame::MM_OnPlay()
{
//wprintf("\nCFrame::OnPlayMusicMod > Begin\n");
//Console::Print("\nCFrame::OnPlayMusicMod > Begin\n");
// Save the volume
MusicMod::GlobalVolume = mm_Slider->GetValue();
@@ -296,7 +296,7 @@ CFrame::MM_OnPlay()
{
if (Core::GetState() == Core::CORE_RUN)
{
//wprintf("CFrame::OnPlayMusicMod > Pause\n");
//Console::Print("CFrame::OnPlayMusicMod > Pause\n");
if(!MusicMod::GlobalPause) // we may has set this elsewhere
{
MusicMod::GlobalPause = true;
@@ -308,7 +308,7 @@ CFrame::MM_OnPlay()
}
else
{
//wprintf("CFrame::OnPlayMusicMod > Play\n");
//Console::Print("CFrame::OnPlayMusicMod > Play\n");
if(MusicMod::GlobalPause) // we may has set this elsewhere
{
MusicMod::GlobalPause = false;
@@ -336,7 +336,7 @@ CFrame::MM_OnStop()
void
CFrame::MM_OnMute(wxCommandEvent& WXUNUSED (event))
{
//wprintf("CFrame::OnMute > Begin\n");
//Console::Print("CFrame::OnMute > Begin\n");
//MessageBox(0, "", "", 0);
if(!MusicMod::GlobalMute)
@@ -368,7 +368,7 @@ CFrame::MM_OnMute(wxCommandEvent& WXUNUSED (event))
void
CFrame::MM_OnPause(wxCommandEvent& WXUNUSED (event))
{
wprintf("CFrame::OnPause > Begin\n");
Console::Print("CFrame::OnPause > Begin\n");
//MessageBox(0, "", "", 0);
if(!MusicMod::GlobalPause)
@@ -399,7 +399,7 @@ CFrame::MM_OnPause(wxCommandEvent& WXUNUSED (event))
// ---------------------------------------------------------------------------------------
void CFrame::MM_OnVolume(wxScrollEvent& event)
{
//wprintf("CFrame::OnVolume > Begin <%i>\n", event.GetPosition());
//Console::Print("CFrame::OnVolume > Begin <%i>\n", event.GetPosition());
//MessageBox(0, "", "", 0);
//if(event.GetEventType() == wxEVT_SCROLL_PAGEUP || event.GetEventType() == wxEVT_SCROLL_PAGEDOWN)
@@ -434,7 +434,7 @@ void CFrame::MM_OnVolume(wxScrollEvent& event)
// ---------------------------------------------------------------------------------------
void CFrame::MM_OnLog(wxCommandEvent& event)
{
//wprintf("CFrame::OnLog > Begin\n");
//Console::Print("CFrame::OnLog > Begin\n");
//MessageBox(0, "", "", 0);
if(!MusicMod::dllloaded) return; // Avoid crash
@@ -450,7 +450,7 @@ void CFrame::MM_OnLog(wxCommandEvent& event)
else
{
#if defined (_WIN32)
FreeConsole(); Player_Console(false);
Console::Close(); Player_Console(false);
#endif
}
+24 -22
View File
@@ -24,7 +24,9 @@
#include <string>
#include <windows.h>
#include "IniFile.h" // Common
#include "Common.h" // Common
#include "IniFile.h"
#include "ConsoleWindow.h"
#include "PowerPC/PowerPc.h" // Core
@@ -32,7 +34,6 @@
#include "../../../../Source/Core/DiscIO/Src/VolumeCreator.h"
#include "../../Player/Src/PlayerExport.h" // Local player
#include "../../Common/Src/Console.h" // Local common
//////////////////////////////////
@@ -54,7 +55,7 @@ void StructSort (std::vector <MyFilesStructure> &MyFiles);
// Playback
std::string currentfile;
std::string CurrentFile;
std::string unique_gameid;
std::string MusicPath;
@@ -95,7 +96,7 @@ void StructSort (std::vector <MyFilesStructure> &MyFiles)
{
MyFilesStructure temp;
//wprintf("StructSort > Begin\n");
//Console::Print("StructSort > Begin\n");
for(int i = 0; i < MyFiles.size() - 1; i++)
{
@@ -116,7 +117,7 @@ void StructSort (std::vector <MyFilesStructure> &MyFiles)
std::cout << i << " " << MyFiles[i].path.c_str() << "#" << MyFiles[i].offset << "\n";
}
//wprintf("StructSort > Done\n");
//Console::Print("StructSort > Done\n");
}
// ============================
@@ -126,7 +127,7 @@ void StructSort (std::vector <MyFilesStructure> &MyFiles)
// ------------------------
void ShowConsole()
{
StartConsoleWin(100, 2000, "Console"); // Give room for 2000 rows
Console::Open(100, 2000, "MusicMod", true); // Give room for 2000 rows
}
void Init()
@@ -150,9 +151,9 @@ void Init()
// Write version
#ifdef _M_X64
wprintf("64 bit version\n");
Console::Print("64 bit version\n");
#else
wprintf("32 bit version\n");
Console::Print("32 bit version\n");
#endif
// -----------
@@ -162,10 +163,11 @@ void Init()
// Show DLL status
Player_Main(MusicMod::bShowConsole);
//play_file("c:\\demo36_02.ast");
//wprintf("DLL loaded\n");
//Console::Print("DLL loaded\n");
dllloaded = true; // Do this once
}
// ============================
// =======================================================================================
@@ -198,7 +200,7 @@ void Main(std::string FileName)
LPSECURITY_ATTRIBUTES attr;
attr = NULL;
MusicPath = "Music\\";
wprintf("Created a Music directory\n");
Console::Print("Created a Music directory\n");
CreateDirectory(MusicPath.c_str(), attr);
// ----------------------------------------------------------------------------------------
}
@@ -210,16 +212,16 @@ void Main(std::string FileName)
void CheckFile(std::string File, int FileNumber)
{
// Do nothing if we found the same file again
if (currentfile == File) return;
if (CurrentFile == File) return;
//wprintf(">>>> (%i)Current read %s <%u = %ux%i> <block %u>\n", i, CurrentFiles[i].path.c_str(), offset, CurrentFiles[i].offset, size);
//Console::Print(">>>> (%i)Current read %s <%u = %ux%i> <block %u>\n", i, CurrentFiles[i].path.c_str(), offset, CurrentFiles[i].offset, size);
if (CheckFileEnding(File.c_str()))
{
wprintf("\n >>> (%i/%i) Match %s\n\n", FileNumber,
Console::Print("\n >>> (%i/%i) Match %s\n\n", FileNumber,
MyFiles.size(), File.c_str());
currentfile = File; // save the found file
CurrentFile = File; // Save the found file
// ---------------------------------------------------------------------------------------
// We will now save the file to the PC hard drive
@@ -235,7 +237,7 @@ void CheckFile(std::string File, int FileNumber)
std::string FilePath = (MusicPath + fragment);
// ---------------------------------------------------------------------------------------
WritingFile = true; // Avoid detecting the file we are writing
wprintf("Writing <%s> to <%s>\n", File.c_str(), FilePath.c_str());
Console::Print("Writing <%s> to <%s>\n", File.c_str(), FilePath.c_str());
my_pFileSystem->ExportFile(File.c_str(), FilePath.c_str());
WritingFile = false;
@@ -245,7 +247,7 @@ void CheckFile(std::string File, int FileNumber)
{
Player_Play((char*)FilePath.c_str()); // retype it from const char* to char*
} else {
wprintf("Warning > Music DLL is not loaded");
Console::Print("Warning > Music DLL is not loaded");
}
// ---------------------------------------------------------------------------------------
@@ -254,9 +256,9 @@ void CheckFile(std::string File, int FileNumber)
{
if(!remove(CurrentPlayFile.c_str()))
{
wprintf("The program failed to remove <%s>\n", CurrentPlayFile.c_str());
Console::Print("The program failed to remove <%s>\n", CurrentPlayFile.c_str());
} else {
wprintf("The program removed <%s>\n", CurrentPlayFile.c_str());
Console::Print("The program removed <%s>\n", CurrentPlayFile.c_str());
}
}
@@ -268,11 +270,11 @@ void CheckFile(std::string File, int FileNumber)
}
// Tell about the files we ignored
wprintf("(%i/%i) Ignored %s\n", FileNumber, MyFiles.size(), File.c_str());
// Tell the user about the files we ignored
Console::Print("(%i/%i) Ignored %s\n", FileNumber, MyFiles.size(), File.c_str());
// Update the current file
currentfile = File;
CurrentFile = File;
}
@@ -328,4 +330,4 @@ void FindFilename(u64 offset, u64 size)
/////////////////////////////////
} // end of namespace
} // end of namespace