From 0f72cdb43e56b8b81e8f86605e8d66b9b772e59d Mon Sep 17 00:00:00 2001 From: tomch Date: Sun, 14 Feb 2010 21:11:26 +0000 Subject: [PATCH] Merge from Tom: r683 Added Speech API support: . Capture char output to COUT . Enable speech via -speech cmd-line . Ctrl+Reset and FullSpeed mode purge the speech buffers Removed #pragma hdrstop from all .cpp files except AppleWin.cpp (which is the PCH create file) --- AppleWin/ApplewinExpress9.00.vcproj | 8 ++ AppleWin/docs/History.txt | 13 +++ AppleWin/source/6821.cpp | 2 +- AppleWin/source/AY8910.cpp | 2 +- AppleWin/source/Applewin.cpp | 22 ++++- AppleWin/source/Applewin.h | 4 + AppleWin/source/CPU.cpp | 88 ++++++++++++++++--- AppleWin/source/Common.h | 1 + AppleWin/source/Debug.cpp | 1 - AppleWin/source/Debugger_Assembler.cpp | 1 - AppleWin/source/Debugger_Console.cpp | 3 +- AppleWin/source/Debugger_DisassemblerData.cpp | 2 +- AppleWin/source/Debugger_Display.cpp | 3 - AppleWin/source/Debugger_Help.cpp | 2 +- AppleWin/source/Debugger_Parser.cpp | 2 +- AppleWin/source/Debugger_Range.cpp | 2 +- AppleWin/source/Debugger_Symbols.cpp | 2 +- AppleWin/source/Disk.cpp | 1 - AppleWin/source/DiskImage.cpp | 5 +- AppleWin/source/Frame.cpp | 10 ++- AppleWin/source/Harddisk.cpp | 1 - AppleWin/source/Joystick.cpp | 1 - AppleWin/source/Keyboard.cpp | 2 +- AppleWin/source/Log.cpp | 2 +- AppleWin/source/Memory.cpp | 1 - AppleWin/source/Mockingboard.cpp | 2 +- AppleWin/source/MouseInterface.cpp | 2 +- AppleWin/source/ParallelPrinter.cpp | 2 - AppleWin/source/PropertySheetPage.cpp | 1 - AppleWin/source/Registry.cpp | 2 +- AppleWin/source/Riff.cpp | 3 - AppleWin/source/SaveState.cpp | 2 +- AppleWin/source/SerialComms.cpp | 1 - AppleWin/source/SoundCore.cpp | 2 +- AppleWin/source/Speaker.cpp | 1 - AppleWin/source/Speech.cpp | 55 ++++++++++++ AppleWin/source/Speech.h | 19 ++++ AppleWin/source/StdAfx.h | 5 +- AppleWin/source/Tape.cpp | 2 +- AppleWin/source/Tfe/Tfe.cpp | 1 - AppleWin/source/Tfe/Tfesupp.cpp | 2 - AppleWin/source/Util_MemoryTextFile.cpp | 2 +- AppleWin/source/Video.cpp | 1 - AppleWin/source/Z80VICE/z80.cpp | 2 +- AppleWin/source/z80emu.cpp | 2 - 45 files changed, 231 insertions(+), 59 deletions(-) create mode 100644 AppleWin/source/Speech.cpp create mode 100644 AppleWin/source/Speech.h diff --git a/AppleWin/ApplewinExpress9.00.vcproj b/AppleWin/ApplewinExpress9.00.vcproj index 768cb4be..dcc754e8 100644 --- a/AppleWin/ApplewinExpress9.00.vcproj +++ b/AppleWin/ApplewinExpress9.00.vcproj @@ -729,6 +729,14 @@ RelativePath=".\source\Speaker.h" > + + + + diff --git a/AppleWin/docs/History.txt b/AppleWin/docs/History.txt index 1b956a25..9285b97e 100644 --- a/AppleWin/docs/History.txt +++ b/AppleWin/docs/History.txt @@ -19,6 +19,19 @@ Restrictions/bugs: - For an original Apple //e, 80-column (PR#3) and INVERSE, it still appears to be mousetext character, but it should be inverted upper-case from $40 to $5F. +1.18.1 - 14 Feb 2010 (beta) +--------------------------- +Changes: +. Added "-speech" cmd-line switch + - Captures text from COUT and outputs to Speech API + - Ctrl+RESET and FullSpeed mode (ie. disk access) will purge the speech buffers + +Fixed: +. [Bug #16699] Debugger: G xxxx not clearing BP +. [Bug #16688] Debugger RUN still not 100% + - Honour absolute path (ie. don't prefix with CWD) + + 1.18.0 - 17 Jan 2010 (beta) --------------------------- Changes: diff --git a/AppleWin/source/6821.cpp b/AppleWin/source/6821.cpp index e6dbb0fd..7be93e3a 100644 --- a/AppleWin/source/6821.cpp +++ b/AppleWin/source/6821.cpp @@ -27,7 +27,7 @@ /*#define MC_DEBUG*/ #include "StdAfx.h" -#pragma hdrstop + #include "6821.h" diff --git a/AppleWin/source/AY8910.cpp b/AppleWin/source/AY8910.cpp index a87ecef2..f7027fcf 100644 --- a/AppleWin/source/AY8910.cpp +++ b/AppleWin/source/AY8910.cpp @@ -25,7 +25,7 @@ // [AppleWin-TC] From FUSE's sound.c module #include "StdAfx.h" -#pragma hdrstop + #include #include diff --git a/AppleWin/source/Applewin.cpp b/AppleWin/source/Applewin.cpp index 5b8cc0f0..39550364 100644 --- a/AppleWin/source/Applewin.cpp +++ b/AppleWin/source/Applewin.cpp @@ -27,12 +27,16 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #include "StdAfx.h" +#pragma hdrstop // Normally would have stdafx.cpp (being the file with /Yc) and wouldn't bother with #pragma hdrstop + #include "DiskImage.h" #include "Harddisk.h" -#pragma hdrstop -#include +//#include // Updated[TC]: Removed, as not needed #include "MouseInterface.h" +#ifdef USE_SPEECH_API +#include "Speech.h" +#endif char VERSIONSTRING[16] = "xx.yy.zz.ww"; @@ -90,6 +94,9 @@ eCPU g_ActiveCPU = CPU_6502; HANDLE g_hCustomRomF8 = INVALID_HANDLE_VALUE; // Cmd-line specified custom ROM at $F800..$FFFF static bool g_bCustomRomF8Failed = false; // Set if custom ROM file failed +static bool g_bEnableSpeech = false; +CSpeech g_Speech; + //=========================================================================== #define DBG_CALC_FREQ 0 @@ -162,6 +169,7 @@ void ContinueExecution() // Don't call Spkr_Mute() - will get speaker clicks MB_Mute(); SysClk_StopTimer(); + g_Speech.Reset(); // TODO: Put this on a timer (in emulated cycles)... otherwise CATALOG cuts out g_nCpuCyclesFeedback = 0; // For the case when this is a big -ve number @@ -852,6 +860,10 @@ int APIENTRY WinMain (HINSTANCE passinstance, HINSTANCE, LPSTR lpCmdLine, int) { g_bEnableDumpToRealPrinter = true; } + else if(strcmp(lpCmdLine, "-speech") == 0) + { + g_bEnableSpeech = true; + } lpCmdLine = lpNextArg; } @@ -912,6 +924,12 @@ int APIENTRY WinMain (HINSTANCE passinstance, HINSTANCE, LPSTR lpCmdLine, int) // . NB. DSInit() & DIMouse::DirectInputInit are done when g_hFrameWindow is created (WM_CREATE) CoInitializeEx(NULL, COINIT_APARTMENTTHREADED); bool bSysClkOK = SysClk_InitTimer(); +#ifdef USE_SPEECH_API + if (g_bEnableSpeech) + { + bool bSpeechOK = g_Speech.Init(); + } +#endif // DO ONE-TIME INITIALIZATION g_hInstance = passinstance; diff --git a/AppleWin/source/Applewin.h b/AppleWin/source/Applewin.h index 49c4beff..50f9cbf4 100644 --- a/AppleWin/source/Applewin.h +++ b/AppleWin/source/Applewin.h @@ -56,3 +56,7 @@ extern HANDLE g_hCustomRomF8; // NULL if no custom rom enum eCPU {CPU_6502=1, CPU_Z80}; extern eCPU g_ActiveCPU; +#ifdef USE_SPEECH_API +class CSpeech; +extern CSpeech g_Speech; +#endif \ No newline at end of file diff --git a/AppleWin/source/CPU.cpp b/AppleWin/source/CPU.cpp index 8d93a190..ccdb71d9 100644 --- a/AppleWin/source/CPU.cpp +++ b/AppleWin/source/CPU.cpp @@ -85,7 +85,6 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA #include "StdAfx.h" -#pragma hdrstop #include "MouseInterface.h" #ifdef SUPPORT_CPM @@ -94,6 +93,10 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA #include "Z80VICE\z80mem.h" #endif +#ifdef USE_SPEECH_API +#include "Speech.h" +#endif + #define AF_SIGN 0x80 #define AF_OVERFLOW 0x40 #define AF_RESERVED 0x20 @@ -841,20 +844,85 @@ void CpuWrite(USHORT addr, BYTE a, ULONG uExecutedCycles) //=========================================================================== +#ifdef USE_SPEECH_API + +const USHORT COUT = 0xFDED; + +const UINT OUTPUT_BUFFER_SIZE = 256; +char g_OutputBuffer[OUTPUT_BUFFER_SIZE+1+1]; // +1 for EOL, +1 for NULL +UINT OutputBufferIdx = 0; +bool bEscMode = false; + +void CaptureCOUT(void) +{ + const char ch = regs.a & 0x7f; + + if (ch == 0x07) // Bell + { + // Ignore + } + else if (ch == 0x08) // Backspace + { + if (OutputBufferIdx) + OutputBufferIdx--; + } + else if (ch == 0x0A) // LF + { + // Ignore + } + else if (ch == 0x0D) // CR + { + if (bEscMode) + { + bEscMode = false; + } + else if (OutputBufferIdx) + { + g_OutputBuffer[OutputBufferIdx] = 0; + g_Speech.Speak(g_OutputBuffer); + +#ifdef _DEBUG + g_OutputBuffer[OutputBufferIdx] = '\n'; + g_OutputBuffer[OutputBufferIdx+1] = 0; + OutputDebugString(g_OutputBuffer); +#endif + + OutputBufferIdx = 0; + } + } + else if (ch == 0x1B) // Escape + { + bEscMode = bEscMode ? false : true; // Toggle mode + } + else if (ch >= ' ' && ch <= '~') + { + if (OutputBufferIdx < OUTPUT_BUFFER_SIZE && !bEscMode) + g_OutputBuffer[OutputBufferIdx++] = ch; + } +} + +#endif + +//=========================================================================== + static __forceinline int Fetch(BYTE& iOpcode, ULONG uExecutedCycles) { - //g_uInternalExecutedCycles = uExecutedCycles; + const USHORT PC = regs.pc; -// iOpcode = *(mem+regs.pc); - iOpcode = ((regs.pc & 0xF000) == 0xC000) - ? IORead[(regs.pc>>4) & 0xFF](regs.pc,regs.pc,0,0,uExecutedCycles) // Fetch opcode from I/O memory, but params are still from mem[] - : *(mem+regs.pc); + iOpcode = ((PC & 0xF000) == 0xC000) + ? IORead[(PC>>4) & 0xFF](PC,PC,0,0,uExecutedCycles) // Fetch opcode from I/O memory, but params are still from mem[] + : *(mem+PC); - if (CheckDebugBreak( iOpcode )) - return 0; + if (CheckDebugBreak( iOpcode )) + return 0; - regs.pc++; - return 1; +#ifdef USE_SPEECH_API + if (PC == COUT && g_Speech.IsEnabled() && !g_bFullSpeed) + CaptureCOUT(); +#endif + + regs.pc++; + return 1; } //#define ENABLE_NMI_SUPPORT // Not used - so don't enable diff --git a/AppleWin/source/Common.h b/AppleWin/source/Common.h index ce04932c..29f56d95 100644 --- a/AppleWin/source/Common.h +++ b/AppleWin/source/Common.h @@ -1,6 +1,7 @@ #pragma once #define SUPPORT_CPM +#define USE_SPEECH_API const double _M14 = (157500000.0 / 11.0); // 14.3181818... * 10^6 const double CLK_6502 = ((_M14 * 65.0) / 912.0); // 65 cycles per 912 14M clocks diff --git a/AppleWin/source/Debug.cpp b/AppleWin/source/Debug.cpp index 15eaf541..1c47103c 100644 --- a/AppleWin/source/Debug.cpp +++ b/AppleWin/source/Debug.cpp @@ -30,7 +30,6 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA //#pragma warning(disable: 4786) #include "StdAfx.h" -#pragma hdrstop // #define DEBUG_COMMAND_HELP 1 // #define DEBUG_ASM_HASH 1 diff --git a/AppleWin/source/Debugger_Assembler.cpp b/AppleWin/source/Debugger_Assembler.cpp index 3d35e7c2..f4e61cf2 100644 --- a/AppleWin/source/Debugger_Assembler.cpp +++ b/AppleWin/source/Debugger_Assembler.cpp @@ -27,7 +27,6 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #include "StdAfx.h" -#pragma hdrstop // Globals __________________________________________________________________ diff --git a/AppleWin/source/Debugger_Console.cpp b/AppleWin/source/Debugger_Console.cpp index c6708fc7..f92034ab 100644 --- a/AppleWin/source/Debugger_Console.cpp +++ b/AppleWin/source/Debugger_Console.cpp @@ -27,8 +27,7 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #include "StdAfx.h" -#pragma hdrstop -#include + // Console ________________________________________________________________________________________ diff --git a/AppleWin/source/Debugger_DisassemblerData.cpp b/AppleWin/source/Debugger_DisassemblerData.cpp index 3a5374f1..20bd0d9b 100644 --- a/AppleWin/source/Debugger_DisassemblerData.cpp +++ b/AppleWin/source/Debugger_DisassemblerData.cpp @@ -7,7 +7,7 @@ AppleWin : An Apple //e emulator for Windows */ #include "StdAfx.h" -#pragma hdrstop + // Disassembler Data ______________________________________________________________________________ diff --git a/AppleWin/source/Debugger_Display.cpp b/AppleWin/source/Debugger_Display.cpp index 5cc39eac..b0cb9ad7 100644 --- a/AppleWin/source/Debugger_Display.cpp +++ b/AppleWin/source/Debugger_Display.cpp @@ -27,11 +27,8 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #include "StdAfx.h" -#pragma hdrstop -#include - // NEW UI debugging #define DEBUG_FORCE_DISPLAY 0 diff --git a/AppleWin/source/Debugger_Help.cpp b/AppleWin/source/Debugger_Help.cpp index 148de662..7de91b73 100644 --- a/AppleWin/source/Debugger_Help.cpp +++ b/AppleWin/source/Debugger_Help.cpp @@ -27,7 +27,7 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #include "StdAfx.h" -#pragma hdrstop + #define DEBUG_COLOR_CONSOLE 0 diff --git a/AppleWin/source/Debugger_Parser.cpp b/AppleWin/source/Debugger_Parser.cpp index 8dc2ff0e..5edcfc52 100644 --- a/AppleWin/source/Debugger_Parser.cpp +++ b/AppleWin/source/Debugger_Parser.cpp @@ -27,7 +27,7 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #include "StdAfx.h" -#pragma hdrstop + // Args ___________________________________________________________________________________________ diff --git a/AppleWin/source/Debugger_Range.cpp b/AppleWin/source/Debugger_Range.cpp index e2942084..62f84031 100644 --- a/AppleWin/source/Debugger_Range.cpp +++ b/AppleWin/source/Debugger_Range.cpp @@ -27,7 +27,7 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #include "StdAfx.h" -#pragma hdrstop + // Util - Range _______________________________________________________________ diff --git a/AppleWin/source/Debugger_Symbols.cpp b/AppleWin/source/Debugger_Symbols.cpp index 84de1e93..a6982775 100644 --- a/AppleWin/source/Debugger_Symbols.cpp +++ b/AppleWin/source/Debugger_Symbols.cpp @@ -1,5 +1,5 @@ #include "StdAfx.h" -#pragma hdrstop + // Symbols ________________________________________________________________________________________ diff --git a/AppleWin/source/Disk.cpp b/AppleWin/source/Disk.cpp index 8fa740b1..2d83958f 100644 --- a/AppleWin/source/Disk.cpp +++ b/AppleWin/source/Disk.cpp @@ -28,7 +28,6 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA #include "StdAfx.h" #include "DiskImage.h" -#pragma hdrstop #include "..\resource\resource.h" #define LOG_DISK_ENABLED 0 diff --git a/AppleWin/source/DiskImage.cpp b/AppleWin/source/DiskImage.cpp index 5adb2d94..465b5821 100644 --- a/AppleWin/source/DiskImage.cpp +++ b/AppleWin/source/DiskImage.cpp @@ -30,7 +30,7 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA #include "StdAfx.h" #include "DiskImage.h" #include "DiskImageHelper.h" -#pragma hdrstop + static CDiskImageHelper sg_DiskImageHelper; @@ -93,7 +93,8 @@ void ImageClose(const HIMAGE hDiskImage, const bool bOpenError /*=false*/) { if (!ptr->ValidTrack[uTrack]) { - // What's the reason for this? + // TODO: Comment using info from this URL: + // http://groups.google.de/group/comp.emulators.apple2/msg/7a1b9317e7905152 bDeleteFile = true; break; } diff --git a/AppleWin/source/Frame.cpp b/AppleWin/source/Frame.cpp index 7cfd83ef..f28ce64d 100644 --- a/AppleWin/source/Frame.cpp +++ b/AppleWin/source/Frame.cpp @@ -29,10 +29,12 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA #include "StdAfx.h" #include "DiskImage.h" #include "Harddisk.h" -#pragma hdrstop #include "MouseInterface.h" #include "..\resource\resource.h" #include +#ifdef USE_SPEECH_API +#include "Speech.h" +#endif //#define ENABLE_MENU 0 @@ -1658,6 +1660,9 @@ void ResetMachineState () #ifdef SUPPORT_CPM g_ActiveCPU = CPU_6502; #endif +#ifdef USE_SPEECH_API + g_Speech.Reset(); +#endif SoundCore_SetFade(FADE_NONE); } @@ -1676,6 +1681,9 @@ void CtrlReset() VideoResetState(); // Switch Alternate char set off sg_SSC.CommReset(); MB_Reset(); +#ifdef USE_SPEECH_API + g_Speech.Reset(); +#endif CpuReset(); g_bFreshReset = true; diff --git a/AppleWin/source/Harddisk.cpp b/AppleWin/source/Harddisk.cpp index 54728470..c85f512f 100644 --- a/AppleWin/source/Harddisk.cpp +++ b/AppleWin/source/Harddisk.cpp @@ -30,7 +30,6 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA #include "HardDisk.h" #include "DiskImage.h" // ImageError_e #include "DiskImageHelper.h" -#pragma hdrstop #include "..\resource\resource.h" /* diff --git a/AppleWin/source/Joystick.cpp b/AppleWin/source/Joystick.cpp index f93241f5..d23628c6 100644 --- a/AppleWin/source/Joystick.cpp +++ b/AppleWin/source/Joystick.cpp @@ -38,7 +38,6 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA // - This is because the 2-joystick version of Mario Bros expects the 2nd joystick to control Apple switch #2. #include "StdAfx.h" -#pragma hdrstop #include "MouseInterface.h" #define BUTTONTIME 5000 diff --git a/AppleWin/source/Keyboard.cpp b/AppleWin/source/Keyboard.cpp index ca2b7464..715a50af 100644 --- a/AppleWin/source/Keyboard.cpp +++ b/AppleWin/source/Keyboard.cpp @@ -27,7 +27,7 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #include "StdAfx.h" -#pragma hdrstop + static bool g_bKeybBufferEnable = false; diff --git a/AppleWin/source/Log.cpp b/AppleWin/source/Log.cpp index 96de8639..ba9439cc 100644 --- a/AppleWin/source/Log.cpp +++ b/AppleWin/source/Log.cpp @@ -27,7 +27,7 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #include "StdAfx.h" -#pragma hdrstop + //--------------------------------------------------------------------------- diff --git a/AppleWin/source/Memory.cpp b/AppleWin/source/Memory.cpp index f0854b60..936256a3 100644 --- a/AppleWin/source/Memory.cpp +++ b/AppleWin/source/Memory.cpp @@ -28,7 +28,6 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA #include "StdAfx.h" #include "Harddisk.h" -#pragma hdrstop #include "MouseInterface.h" #ifdef SUPPORT_CPM #include "z80emu.h" diff --git a/AppleWin/source/Mockingboard.cpp b/AppleWin/source/Mockingboard.cpp index 98b23de4..664c037b 100644 --- a/AppleWin/source/Mockingboard.cpp +++ b/AppleWin/source/Mockingboard.cpp @@ -76,7 +76,7 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA // #include "StdAfx.h" -#pragma hdrstop + #define LOG_SSI263 0 diff --git a/AppleWin/source/MouseInterface.cpp b/AppleWin/source/MouseInterface.cpp index e58f66bc..69e01927 100644 --- a/AppleWin/source/MouseInterface.cpp +++ b/AppleWin/source/MouseInterface.cpp @@ -41,7 +41,7 @@ Etc. #include "stdafx.h" -#pragma hdrstop + #ifdef _DEBUG #define _DEBUG_SPURIOUS_IRQ diff --git a/AppleWin/source/ParallelPrinter.cpp b/AppleWin/source/ParallelPrinter.cpp index eae9d5a4..b8c6ef16 100644 --- a/AppleWin/source/ParallelPrinter.cpp +++ b/AppleWin/source/ParallelPrinter.cpp @@ -27,9 +27,7 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #include "StdAfx.h" -#pragma hdrstop #include "..\resource\resource.h" -#include static DWORD inactivity = 0; static FILE* file = NULL; diff --git a/AppleWin/source/PropertySheetPage.cpp b/AppleWin/source/PropertySheetPage.cpp index fcdd4de6..5be3341c 100644 --- a/AppleWin/source/PropertySheetPage.cpp +++ b/AppleWin/source/PropertySheetPage.cpp @@ -29,7 +29,6 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA #include "StdAfx.h" #include "Harddisk.h" -#pragma hdrstop #include "..\resource\resource.h" #include "Tfe\Tfesupp.h" #include "Tfe\Uilib.h" diff --git a/AppleWin/source/Registry.cpp b/AppleWin/source/Registry.cpp index e3cdb7d7..06d81b16 100644 --- a/AppleWin/source/Registry.cpp +++ b/AppleWin/source/Registry.cpp @@ -27,7 +27,7 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #include "StdAfx.h" -#pragma hdrstop + //=========================================================================== BOOL RegLoadString (LPCTSTR section, LPCTSTR key, BOOL peruser, diff --git a/AppleWin/source/Riff.cpp b/AppleWin/source/Riff.cpp index 4a406cd4..8b95bf5a 100644 --- a/AppleWin/source/Riff.cpp +++ b/AppleWin/source/Riff.cpp @@ -27,9 +27,6 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #include "Stdafx.h" -#pragma hdrstop - -#include #include "riff.h" static HANDLE g_hRiffFile = INVALID_HANDLE_VALUE; diff --git a/AppleWin/source/SaveState.cpp b/AppleWin/source/SaveState.cpp index 39fc4178..7713303a 100644 --- a/AppleWin/source/SaveState.cpp +++ b/AppleWin/source/SaveState.cpp @@ -27,7 +27,7 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #include "StdAfx.h" -#pragma hdrstop + #define DEFAULT_SNAPSHOT_NAME "SaveState.aws" diff --git a/AppleWin/source/SerialComms.cpp b/AppleWin/source/SerialComms.cpp index 9afeb93e..6373b25f 100644 --- a/AppleWin/source/SerialComms.cpp +++ b/AppleWin/source/SerialComms.cpp @@ -39,7 +39,6 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA // #include "StdAfx.h" -#pragma hdrstop #include "..\resource\resource.h" //#define SUPPORT_MODEM diff --git a/AppleWin/source/SoundCore.cpp b/AppleWin/source/SoundCore.cpp index fd206387..e28ed3fd 100644 --- a/AppleWin/source/SoundCore.cpp +++ b/AppleWin/source/SoundCore.cpp @@ -27,7 +27,7 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #include "StdAfx.h" -#pragma hdrstop + //----------------------------------------------------------------------------- diff --git a/AppleWin/source/Speaker.cpp b/AppleWin/source/Speaker.cpp index 1837e56e..a71d15cc 100644 --- a/AppleWin/source/Speaker.cpp +++ b/AppleWin/source/Speaker.cpp @@ -27,7 +27,6 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #include "StdAfx.h" -#pragma hdrstop #include // Notes: diff --git a/AppleWin/source/Speech.cpp b/AppleWin/source/Speech.cpp new file mode 100644 index 00000000..cdcb03e0 --- /dev/null +++ b/AppleWin/source/Speech.cpp @@ -0,0 +1,55 @@ +#include "StdAfx.h" +#include +#include "Speech.h" + +CSpeech::~CSpeech(void) +{ + // Don't do this: causes crash on app exit! + //if (m_cpVoice) + // m_cpVoice->Release(); +} + +bool CSpeech::Init(void) +{ + HRESULT hr = CoCreateInstance(CLSID_SpVoice, NULL, CLSCTX_INPROC, IID_ISpVoice, (LPVOID*)&m_cpVoice); + return hr == S_OK; +} + +void CSpeech::Reset(void) +{ + if (!m_cpVoice) + return; + + HRESULT hr = m_cpVoice->Speak(NULL, SPF_PURGEBEFORESPEAK, 0); + _ASSERT(hr == S_OK); +} + +void CSpeech::Speak(const char* const pBuffer) +{ + if (!m_cpVoice) + return; + + size_t uSize; + errno_t err = mbstowcs_s(&uSize, NULL, 0, pBuffer, 0); + if (err) + return; + + WCHAR* pszWTextString = new WCHAR[uSize]; + if (!pszWTextString) + return; + + err = mbstowcs_s(&uSize, pszWTextString, uSize, pBuffer, uSize); + if (err) + { + delete [] pszWTextString; + return; + } + + HRESULT hr = m_cpVoice->Speak(pszWTextString, SPF_ASYNC | SPF_IS_NOT_XML, 0); + _ASSERT(hr == S_OK); + + hr = m_cpVoice->Resume(); + _ASSERT(hr == S_OK); + + delete [] pszWTextString; +} diff --git a/AppleWin/source/Speech.h b/AppleWin/source/Speech.h new file mode 100644 index 00000000..3af1a764 --- /dev/null +++ b/AppleWin/source/Speech.h @@ -0,0 +1,19 @@ +struct ISpVoice; + +class CSpeech +{ +public: + CSpeech() : + m_cpVoice(NULL) + { + } + virtual ~CSpeech(); + + bool Init(void); + void Reset(void); + bool IsEnabled(void) { return m_cpVoice != NULL; } + void Speak(const char* const pBuffer); + +private: + ISpVoice* m_cpVoice; +}; diff --git a/AppleWin/source/StdAfx.h b/AppleWin/source/StdAfx.h index 9390b19e..d2ec00f9 100644 --- a/AppleWin/source/StdAfx.h +++ b/AppleWin/source/StdAfx.h @@ -1,9 +1,9 @@ //#define WIN32_LEAN_AND_MEAN -#define _WIN32_WINNT 0x0400 // For CoInitializeEx() to get defined in objbase.h +//#define _WIN32_WINNT 0x0400 // For CoInitializeEx() to get defined in objbase.h (Updated[TC]: Removed as not needed) // Mouse Wheel is not supported on Win95. // If we didn't care about supporting Win95 (compile/run-time errors) -// we would just define the minmimum windows version to support. +// we would just define the minimum windows version to support. // #define _WIN32_WINDOWS 0x0401 #ifndef WM_MOUSEWHEEL #define WM_MOUSEWHEEL 0x020A @@ -27,6 +27,7 @@ #include #include #include +#include #include #include diff --git a/AppleWin/source/Tape.cpp b/AppleWin/source/Tape.cpp index e40169c7..bbdd1920 100644 --- a/AppleWin/source/Tape.cpp +++ b/AppleWin/source/Tape.cpp @@ -29,7 +29,7 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #include "StdAfx.h" -#pragma hdrstop + static BYTE C060 = 255; static bool CapsLockAllowed = false; diff --git a/AppleWin/source/Tfe/Tfe.cpp b/AppleWin/source/Tfe/Tfe.cpp index 7804edc2..5f24ce14 100644 --- a/AppleWin/source/Tfe/Tfe.cpp +++ b/AppleWin/source/Tfe/Tfe.cpp @@ -25,7 +25,6 @@ */ #include "..\StdAfx.h" -#pragma hdrstop #include #include diff --git a/AppleWin/source/Tfe/Tfesupp.cpp b/AppleWin/source/Tfe/Tfesupp.cpp index d77a63b9..0ba63a3f 100644 --- a/AppleWin/source/Tfe/Tfesupp.cpp +++ b/AppleWin/source/Tfe/Tfesupp.cpp @@ -33,8 +33,6 @@ * */ -#pragma hdrstop - #include #include #include diff --git a/AppleWin/source/Util_MemoryTextFile.cpp b/AppleWin/source/Util_MemoryTextFile.cpp index 3d06cbc0..817d64b5 100644 --- a/AppleWin/source/Util_MemoryTextFile.cpp +++ b/AppleWin/source/Util_MemoryTextFile.cpp @@ -1,5 +1,5 @@ #include "StdAfx.h" -#pragma hdrstop + // MemoryTextFile _________________________________________________________________________________ diff --git a/AppleWin/source/Video.cpp b/AppleWin/source/Video.cpp index 6e48549c..3f9d11e2 100644 --- a/AppleWin/source/Video.cpp +++ b/AppleWin/source/Video.cpp @@ -27,7 +27,6 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #include "StdAfx.h" -#pragma hdrstop #include "..\resource\resource.h" /* reference: technote tn-iigs-063 "Master Color Values" diff --git a/AppleWin/source/Z80VICE/z80.cpp b/AppleWin/source/Z80VICE/z80.cpp index f68f089a..c7cae58c 100644 --- a/AppleWin/source/Z80VICE/z80.cpp +++ b/AppleWin/source/Z80VICE/z80.cpp @@ -25,7 +25,7 @@ */ #include "..\stdafx.h" -#pragma hdrstop + #undef IN // Defined in windef.h #undef OUT // Defined in windef.h diff --git a/AppleWin/source/z80emu.cpp b/AppleWin/source/z80emu.cpp index 2790eed9..58468c85 100644 --- a/AppleWin/source/z80emu.cpp +++ b/AppleWin/source/z80emu.cpp @@ -14,8 +14,6 @@ // Emula a CPU Z80 #include "StdAfx.h" -#pragma hdrstop - #include "z80emu.h" // Variaveis