1.22.1.2: extended logging for:
. WM_CREATE, WM_CLOSE + others . DIMouse::DirectInputInit() . MB_Initialize()
This commit is contained in:
parent
0732779eeb
commit
639f1e88e1
5 changed files with 91 additions and 24 deletions
|
@ -253,8 +253,8 @@ DISK_ICON ICON "DISK.ICO"
|
|||
//
|
||||
|
||||
VS_VERSION_INFO VERSIONINFO
|
||||
FILEVERSION 1,22,1,1
|
||||
PRODUCTVERSION 1,22,1,1
|
||||
FILEVERSION 1,22,1,2
|
||||
PRODUCTVERSION 1,22,1,2
|
||||
FILEFLAGSMASK 0x3fL
|
||||
#ifdef _DEBUG
|
||||
FILEFLAGS 0x1L
|
||||
|
@ -272,12 +272,12 @@ BEGIN
|
|||
VALUE "Comments", "http://applewin.berlios.de"
|
||||
VALUE "CompanyName", "AppleWin"
|
||||
VALUE "FileDescription", "Apple //e Emulator for Windows"
|
||||
VALUE "FileVersion", "1, 22, 1, 1"
|
||||
VALUE "FileVersion", "1, 22, 1, 2"
|
||||
VALUE "InternalName", "APPLEWIN"
|
||||
VALUE "LegalCopyright", " 1994-2013 Michael O'Brien, Oliver Schmidt, Tom Charlesworth, Michael Pohoreski, Nick Westgate, Linards Ticmanis"
|
||||
VALUE "OriginalFilename", "APPLEWIN.EXE"
|
||||
VALUE "ProductName", "Apple //e Emulator"
|
||||
VALUE "ProductVersion", "1, 22, 1, 1"
|
||||
VALUE "ProductVersion", "1, 22, 1, 2"
|
||||
END
|
||||
END
|
||||
BLOCK "VarFileInfo"
|
||||
|
|
|
@ -955,8 +955,9 @@ int APIENTRY WinMain (HINSTANCE passinstance, HINSTANCE, LPSTR lpCmdLine, int)
|
|||
VideoInitialize(); // g_pFramebufferinfo been created now
|
||||
LogFileOutput("Init: VideoInitialize()\n");
|
||||
|
||||
LogFileOutput("Init: FrameCreateWindow() - pre\n");
|
||||
FrameCreateWindow();
|
||||
LogFileOutput("Init: FrameCreateWindow()\n");
|
||||
LogFileOutput("Init: FrameCreateWindow() - post\n");
|
||||
|
||||
// PrintScrn support
|
||||
AppleWin_RegisterHotKeys(); // needs valid g_hFrameWindow
|
||||
|
|
|
@ -706,6 +706,7 @@ LRESULT CALLBACK FrameWndProc (
|
|||
break;
|
||||
|
||||
case WM_CLOSE:
|
||||
LogFileOutput("WM_CLOSE\n");
|
||||
if (g_bIsFullScreen)
|
||||
SetNormalMode();
|
||||
if (!IsIconic(window))
|
||||
|
@ -718,6 +719,7 @@ LRESULT CALLBACK FrameWndProc (
|
|||
helpquit = 0;
|
||||
HtmlHelp(NULL,NULL,HH_CLOSE_ALL,0);
|
||||
}
|
||||
LogFileOutput("WM_CLOSE (done)\n");
|
||||
break;
|
||||
|
||||
case WM_CHAR:
|
||||
|
@ -739,26 +741,44 @@ LRESULT CALLBACK FrameWndProc (
|
|||
break;
|
||||
|
||||
case WM_CREATE:
|
||||
LogFileOutput("WM_CREATE\n");
|
||||
g_hFrameWindow = window;
|
||||
|
||||
CreateGdiObjects();
|
||||
LogFileOutput("WM_CREATE: CreateGdiObjects()\n");
|
||||
|
||||
DSInit();
|
||||
LogFileOutput("WM_CREATE: DSInit()\n");
|
||||
|
||||
DIMouse::DirectInputInit(window);
|
||||
MB_Initialize();
|
||||
SpkrInitialize();
|
||||
DragAcceptFiles(window,1);
|
||||
break;
|
||||
LogFileOutput("WM_CREATE: DIMouse::DirectInputInit()\n");
|
||||
|
||||
MB_Initialize();
|
||||
LogFileOutput("WM_CREATE: MB_Initialize()\n");
|
||||
|
||||
SpkrInitialize();
|
||||
LogFileOutput("WM_CREATE: SpkrInitialize()\n");
|
||||
|
||||
DragAcceptFiles(window,1);
|
||||
LogFileOutput("WM_CREATE: DragAcceptFiles()\n");
|
||||
|
||||
LogFileOutput("WM_CREATE (done)\n");
|
||||
break;
|
||||
|
||||
case WM_DDE_INITIATE: {
|
||||
LogFileOutput("WM_DDE_INITIATE\n");
|
||||
ATOM application = GlobalAddAtom(TEXT("applewin"));
|
||||
ATOM topic = GlobalAddAtom(TEXT("system"));
|
||||
if(LOWORD(lparam) == application && HIWORD(lparam) == topic)
|
||||
SendMessage((HWND)wparam,WM_DDE_ACK,(WPARAM)window,MAKELPARAM(application,topic));
|
||||
GlobalDeleteAtom(application);
|
||||
GlobalDeleteAtom(topic);
|
||||
LogFileOutput("WM_DDE_INITIATE (done)\n");
|
||||
break;
|
||||
}
|
||||
|
||||
case WM_DDE_EXECUTE: {
|
||||
LogFileOutput("WM_DDE_EXECUTE\n");
|
||||
LPTSTR filename = (LPTSTR)GlobalLock((HGLOBAL)lparam);
|
||||
//MessageBox( NULL, filename, "DDE Exec", MB_OK );
|
||||
ImageError_e Error = DiskInsert(DRIVE_1, filename, IMAGE_USE_FILES_WRITE_PROTECT_STATUS, IMAGE_DONT_CREATE);
|
||||
|
@ -774,10 +794,12 @@ LRESULT CALLBACK FrameWndProc (
|
|||
DiskNotifyInvalidImage(DRIVE_1, filename, Error);
|
||||
}
|
||||
GlobalUnlock((HGLOBAL)lparam);
|
||||
LogFileOutput("WM_DDE_EXECUTE (done)\n");
|
||||
break;
|
||||
}
|
||||
|
||||
case WM_DESTROY:
|
||||
LogFileOutput("WM_DESTROY\n");
|
||||
DragAcceptFiles(window,0);
|
||||
Snapshot_Shutdown();
|
||||
DebugDestroy();
|
||||
|
@ -796,6 +818,7 @@ LRESULT CALLBACK FrameWndProc (
|
|||
DeleteGdiObjects();
|
||||
DIMouse::DirectInputUninit(window);
|
||||
PostQuitMessage(0); // Post WM_QUIT message to the thread's message queue
|
||||
LogFileOutput("WM_DESTROY (done)\n");
|
||||
break;
|
||||
|
||||
case WM_DISPLAYCHANGE:
|
||||
|
|
|
@ -1086,6 +1086,7 @@ static void SSI263_Play(unsigned int nPhoneme)
|
|||
|
||||
static bool MB_DSInit()
|
||||
{
|
||||
LogFileOutput("MB_DSInit\n", g_bMBAvailable);
|
||||
#ifdef NO_DIRECT_X
|
||||
|
||||
return false;
|
||||
|
@ -1103,13 +1104,16 @@ static bool MB_DSInit()
|
|||
return false;
|
||||
|
||||
HRESULT hr = DSGetSoundBuffer(&MockingboardVoice, DSBCAPS_CTRLVOLUME, g_dwDSBufferSize, SAMPLE_RATE, 2);
|
||||
LogFileOutput("MB_DSInit: DSGetSoundBuffer(), hr=0x%08X\n", hr);
|
||||
if(FAILED(hr))
|
||||
{
|
||||
if(g_fh) fprintf(g_fh, "MB: DSGetSoundBuffer failed (%08X)\n",hr);
|
||||
return false;
|
||||
}
|
||||
|
||||
if(!DSZeroVoiceBuffer(&MockingboardVoice, "MB", g_dwDSBufferSize))
|
||||
bool bRes = DSZeroVoiceBuffer(&MockingboardVoice, "MB", g_dwDSBufferSize);
|
||||
LogFileOutput("MB_DSInit: DSZeroVoiceBuffer(), res=%d\n", bRes ? 1 : 0);
|
||||
if (!bRes)
|
||||
return false;
|
||||
|
||||
MockingboardVoice.bActive = true;
|
||||
|
@ -1118,7 +1122,8 @@ static bool MB_DSInit()
|
|||
if(!MockingboardVoice.nVolume)
|
||||
MockingboardVoice.nVolume = DSBVOLUME_MAX;
|
||||
|
||||
MockingboardVoice.lpDSBvoice->SetVolume(MockingboardVoice.nVolume);
|
||||
hr = MockingboardVoice.lpDSBvoice->SetVolume(MockingboardVoice.nVolume);
|
||||
LogFileOutput("MB_DSInit: SetVolume(), hr=0x%08X\n", hr);
|
||||
|
||||
//---------------------------------
|
||||
|
||||
|
@ -1138,11 +1143,13 @@ static bool MB_DSInit()
|
|||
FALSE, // bManualReset (FALSE = auto-reset)
|
||||
FALSE, // bInitialState (FALSE = non-signaled)
|
||||
NULL); // lpName
|
||||
LogFileOutput("MB_DSInit: CreateEvent(), g_hSSI263Event[0]=0x%08X\n", (UINT32)g_hSSI263Event[0]);
|
||||
|
||||
g_hSSI263Event[1] = CreateEvent(NULL, // lpEventAttributes
|
||||
FALSE, // bManualReset (FALSE = auto-reset)
|
||||
FALSE, // bInitialState (FALSE = non-signaled)
|
||||
NULL); // lpName
|
||||
LogFileOutput("MB_DSInit: CreateEvent(), g_hSSI263Event[1]=0x%08X\n", (UINT32)g_hSSI263Event[1]);
|
||||
|
||||
if((g_hSSI263Event[0] == NULL) || (g_hSSI263Event[1] == NULL))
|
||||
{
|
||||
|
@ -1173,13 +1180,15 @@ static bool MB_DSInit()
|
|||
|
||||
// NB. DSBCAPS_LOCSOFTWARE required for Phoneme+2==0x28 - sample too short (see KB327698)
|
||||
hr = DSGetSoundBuffer(&SSI263Voice[i], DSBCAPS_CTRLVOLUME+DSBCAPS_CTRLPOSITIONNOTIFY+DSBCAPS_LOCSOFTWARE, nPhonemeByteLength, 22050, 1);
|
||||
LogFileOutput("MB_DSInit: (%02d) DSGetSoundBuffer(), hr=0x%08X\n", i, hr);
|
||||
if(FAILED(hr))
|
||||
{
|
||||
if(g_fh) fprintf(g_fh, "SSI263: DSGetSoundBuffer failed (%08X)\n",hr);
|
||||
return false;
|
||||
}
|
||||
|
||||
hr = DSGetLock(SSI263Voice[i].lpDSBvoice, 0, 0, &pDSLockedBuffer, &dwDSLockedBufferSize, NULL, 0);
|
||||
bRes = DSGetLock(SSI263Voice[i].lpDSBvoice, 0, 0, &pDSLockedBuffer, &dwDSLockedBufferSize, NULL, 0);
|
||||
LogFileOutput("MB_DSInit: (%02d) DSGetLock(), res=%d\n", i, bRes ? 1 : 0); // WARNING: Lock acquired && doing heavy-weight logging
|
||||
if(FAILED(hr))
|
||||
{
|
||||
if(g_fh) fprintf(g_fh, "SSI263: DSGetLock failed (%08X)\n",hr);
|
||||
|
@ -1197,6 +1206,7 @@ static bool MB_DSInit()
|
|||
}
|
||||
|
||||
hr = SSI263Voice[i].lpDSBvoice->QueryInterface(IID_IDirectSoundNotify, (LPVOID *)&SSI263Voice[i].lpDSNotify);
|
||||
LogFileOutput("MB_DSInit: (%02d) QueryInterface(), hr=0x%08X\n", i, hr); // WARNING: Lock acquired && doing heavy-weight logging
|
||||
if(FAILED(hr))
|
||||
{
|
||||
if(g_fh) fprintf(g_fh, "SSI263: QueryInterface failed (%08X)\n",hr);
|
||||
|
@ -1210,6 +1220,7 @@ static bool MB_DSInit()
|
|||
PositionNotify.hEventNotify = g_hSSI263Event[0];
|
||||
|
||||
hr = SSI263Voice[i].lpDSNotify->SetNotificationPositions(1, &PositionNotify);
|
||||
LogFileOutput("MB_DSInit: (%02d) SetNotificationPositions(), hr=0x%08X\n", i, hr); // WARNING: Lock acquired && doing heavy-weight logging
|
||||
if(FAILED(hr))
|
||||
{
|
||||
if(g_fh) fprintf(g_fh, "SSI263: SetNotifyPos failed (%08X)\n",hr);
|
||||
|
@ -1217,6 +1228,7 @@ static bool MB_DSInit()
|
|||
}
|
||||
|
||||
hr = SSI263Voice[i].lpDSBvoice->Unlock((void*)pDSLockedBuffer, dwDSLockedBufferSize, NULL, 0);
|
||||
LogFileOutput("MB_DSInit: (%02d) Unlock(),hr=0x%08X\n", i, hr);
|
||||
if(FAILED(hr))
|
||||
{
|
||||
if(g_fh) fprintf(g_fh, "SSI263: DSUnlock failed (%08X)\n",hr);
|
||||
|
@ -1225,7 +1237,8 @@ static bool MB_DSInit()
|
|||
|
||||
SSI263Voice[i].bActive = false;
|
||||
SSI263Voice[i].nVolume = MockingboardVoice.nVolume; // Use same volume as MB
|
||||
SSI263Voice[i].lpDSBvoice->SetVolume(SSI263Voice[i].nVolume);
|
||||
hr = SSI263Voice[i].lpDSBvoice->SetVolume(SSI263Voice[i].nVolume);
|
||||
LogFileOutput("MB_DSInit: (%02d) SetVolume(), hr=0x%08X\n", i, hr);
|
||||
}
|
||||
|
||||
//
|
||||
|
@ -1238,8 +1251,10 @@ static bool MB_DSInit()
|
|||
NULL, // lpParameter
|
||||
0, // dwCreationFlags : 0 = Run immediately
|
||||
&dwThreadId); // lpThreadId
|
||||
LogFileOutput("MB_DSInit: CreateThread(), g_hThread=0x%08X\n", (UINT32)g_hThread);
|
||||
|
||||
SetThreadPriority(g_hThread, THREAD_PRIORITY_TIME_CRITICAL);
|
||||
BOOL bRes2 = SetThreadPriority(g_hThread, THREAD_PRIORITY_TIME_CRITICAL);
|
||||
LogFileOutput("MB_DSInit: SetThreadPriority(), bRes=%d\n", bRes2 ? 1 : 0);
|
||||
|
||||
return true;
|
||||
|
||||
|
@ -1317,6 +1332,7 @@ static void MB_DSUninit()
|
|||
|
||||
void MB_Initialize()
|
||||
{
|
||||
LogFileOutput("MB_Initialize: g_bDisableDirectSound=%d, g_bDisableDirectSoundMockingboard=%d\n", g_bDisableDirectSound, g_bDisableDirectSoundMockingboard);
|
||||
if (g_bDisableDirectSound || g_bDisableDirectSoundMockingboard)
|
||||
{
|
||||
MockingboardVoice.bMute = true;
|
||||
|
@ -1331,6 +1347,7 @@ void MB_Initialize()
|
|||
ppAYVoiceBuffer[i] = new short [SAMPLE_RATE]; // Buffer can hold a max of 1 seconds worth of samples
|
||||
|
||||
AY8910_InitAll((int)g_fCurrentCLK6502, SAMPLE_RATE);
|
||||
LogFileOutput("MB_Initialize: AY8910_InitAll()\n");
|
||||
|
||||
for(i=0; i<NUM_AY8910; i++)
|
||||
g_MB[i].nAY8910Number = i;
|
||||
|
@ -1338,8 +1355,10 @@ void MB_Initialize()
|
|||
//
|
||||
|
||||
g_bMBAvailable = MB_DSInit();
|
||||
LogFileOutput("MB_Initialize: MB_DSInit(), g_bMBAvailable=%d\n", g_bMBAvailable);
|
||||
|
||||
MB_Reset();
|
||||
LogFileOutput("MB_Initialize: MB_Reset()\n");
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -608,6 +608,7 @@ namespace DIMouse
|
|||
//-----------------------------------------------------------------------------
|
||||
HRESULT DirectInputInit( HWND hDlg )
|
||||
{
|
||||
LogFileOutput("DirectInputInit\n");
|
||||
#ifdef NO_DIRECT_X
|
||||
|
||||
return E_FAIL;
|
||||
|
@ -621,6 +622,7 @@ namespace DIMouse
|
|||
DWORD dwCoopFlags;
|
||||
|
||||
DirectInputUninit(hDlg);
|
||||
LogFileOutput("DirectInputInit: DirectInputUninit()\n");
|
||||
|
||||
// Determine where the buffer would like to be allocated
|
||||
bExclusive = FALSE;
|
||||
|
@ -638,12 +640,15 @@ namespace DIMouse
|
|||
dwCoopFlags |= DISCL_BACKGROUND;
|
||||
|
||||
// Create a DInput object
|
||||
if( FAILED( hr = DirectInput8Create( GetModuleHandle(NULL), DIRECTINPUT_VERSION,
|
||||
IID_IDirectInput8, (VOID**)&g_pDI, NULL ) ) )
|
||||
hr = DirectInput8Create( GetModuleHandle(NULL), DIRECTINPUT_VERSION, IID_IDirectInput8, (VOID**)&g_pDI, NULL );
|
||||
LogFileOutput("DirectInputInit: DirectInputUninit(), hr=0x%08X\n", hr);
|
||||
if (FAILED(hr))
|
||||
return hr;
|
||||
|
||||
// Obtain an interface to the system mouse device.
|
||||
if( FAILED( hr = g_pDI->CreateDevice( GUID_SysMouse, &g_pMouse, NULL ) ) )
|
||||
hr = g_pDI->CreateDevice( GUID_SysMouse, &g_pMouse, NULL );
|
||||
LogFileOutput("DirectInputInit: CreateDevice(), hr=0x%08X\n", hr);
|
||||
if (FAILED(hr))
|
||||
return hr;
|
||||
|
||||
// Set the data format to "mouse format" - a predefined data format
|
||||
|
@ -653,16 +658,20 @@ namespace DIMouse
|
|||
//
|
||||
// This tells DirectInput that we will be passing a
|
||||
// DIMOUSESTATE2 structure to IDirectInputDevice::GetDeviceState.
|
||||
if( FAILED( hr = g_pMouse->SetDataFormat( &c_dfDIMouse2 ) ) )
|
||||
hr = g_pMouse->SetDataFormat( &c_dfDIMouse2 );
|
||||
LogFileOutput("DirectInputInit: SetDataFormat(), hr=0x%08X\n", hr);
|
||||
if (FAILED(hr))
|
||||
return hr;
|
||||
|
||||
// Set the cooperativity level to let DirectInput know how
|
||||
// this device should interact with the system and with other
|
||||
// DirectInput applications.
|
||||
hr = g_pMouse->SetCooperativeLevel( hDlg, dwCoopFlags );
|
||||
LogFileOutput("DirectInputInit: SetCooperativeLevel(), hr=0x%08X\n", hr);
|
||||
if( hr == DIERR_UNSUPPORTED && !bForeground && bExclusive )
|
||||
{
|
||||
DirectInputUninit(hDlg);
|
||||
LogFileOutput("DirectInputInit: DirectInputUninit()n");
|
||||
//MessageBox( hDlg, _T("SetCooperativeLevel() returned DIERR_UNSUPPORTED.\n")
|
||||
// _T("For security reasons, background exclusive mouse\n")
|
||||
// _T("access is not allowed."),
|
||||
|
@ -691,17 +700,23 @@ namespace DIMouse
|
|||
dipdw.diph.dwHow = DIPH_DEVICE;
|
||||
dipdw.dwData = SAMPLE_BUFFER_SIZE; // Arbitary buffer size
|
||||
|
||||
if( FAILED( hr = g_pMouse->SetProperty( DIPROP_BUFFERSIZE, &dipdw.diph ) ) )
|
||||
hr = g_pMouse->SetProperty( DIPROP_BUFFERSIZE, &dipdw.diph );
|
||||
LogFileOutput("DirectInputInit: SetProperty(), hr=0x%08X\n", hr);
|
||||
if (FAILED(hr))
|
||||
return hr;
|
||||
}
|
||||
|
||||
// Acquire the newly created device
|
||||
if (FAILED(hr = g_pMouse->Acquire()))
|
||||
hr = g_pMouse->Acquire();
|
||||
LogFileOutput("DirectInputInit: Acquire(), hr=0x%08X\n", hr);
|
||||
if (FAILED(hr))
|
||||
return hr;
|
||||
|
||||
// Setup timer to read mouse position
|
||||
if (g_TimerIDEvent = SetTimer(hDlg, IDEVENT_TIMER_MOUSE, 8, NULL) == 0) // 120Hz timer
|
||||
return -1;
|
||||
g_TimerIDEvent = SetTimer(hDlg, IDEVENT_TIMER_MOUSE, 8, NULL); // 120Hz timer
|
||||
LogFileOutput("DirectInputInit: SetTimer(), id=0x%08X\n", g_TimerIDEvent);
|
||||
if (g_TimerIDEvent == 0)
|
||||
return E_FAIL;
|
||||
|
||||
return S_OK;
|
||||
|
||||
|
@ -714,17 +729,26 @@ namespace DIMouse
|
|||
//-----------------------------------------------------------------------------
|
||||
void DirectInputUninit( HWND hDlg )
|
||||
{
|
||||
LogFileOutput("DirectInputUninit\n");
|
||||
|
||||
// Unacquire the device one last time just in case
|
||||
// the app tried to exit while the device is still acquired.
|
||||
if( g_pMouse )
|
||||
g_pMouse->Unacquire();
|
||||
{
|
||||
HRESULT hr = g_pMouse->Unacquire();
|
||||
LogFileOutput("DirectInputUninit: Unacquire(), hr=0x%08X\n", hr);
|
||||
}
|
||||
|
||||
// Release any DirectInput objects.
|
||||
SAFE_RELEASE( g_pMouse );
|
||||
SAFE_RELEASE( g_pDI );
|
||||
|
||||
if (g_TimerIDEvent)
|
||||
KillTimer(hDlg, g_TimerIDEvent);
|
||||
{
|
||||
BOOL bRes = KillTimer(hDlg, g_TimerIDEvent);
|
||||
LogFileOutput("DirectInputUninit: KillTimer(), res=%d\n", bRes ? 1 : 0);
|
||||
g_TimerIDEvent = 0;
|
||||
}
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
|
|
Loading…
Add table
Reference in a new issue