mirror of
https://github.com/AppleWin/AppleWin.git
synced 2025-01-29 02:31:25 +00:00
1.22.1.1: extended logging on init & shutdown
This commit is contained in:
parent
6ffa1e54ef
commit
0004e290c4
@ -253,8 +253,8 @@ DISK_ICON ICON "DISK.ICO"
|
|||||||
//
|
//
|
||||||
|
|
||||||
VS_VERSION_INFO VERSIONINFO
|
VS_VERSION_INFO VERSIONINFO
|
||||||
FILEVERSION 1,22,1,0
|
FILEVERSION 1,22,1,1
|
||||||
PRODUCTVERSION 1,22,1,0
|
PRODUCTVERSION 1,22,1,1
|
||||||
FILEFLAGSMASK 0x3fL
|
FILEFLAGSMASK 0x3fL
|
||||||
#ifdef _DEBUG
|
#ifdef _DEBUG
|
||||||
FILEFLAGS 0x1L
|
FILEFLAGS 0x1L
|
||||||
@ -272,12 +272,12 @@ BEGIN
|
|||||||
VALUE "Comments", "http://applewin.berlios.de"
|
VALUE "Comments", "http://applewin.berlios.de"
|
||||||
VALUE "CompanyName", "AppleWin"
|
VALUE "CompanyName", "AppleWin"
|
||||||
VALUE "FileDescription", "Apple //e Emulator for Windows"
|
VALUE "FileDescription", "Apple //e Emulator for Windows"
|
||||||
VALUE "FileVersion", "1, 22, 1, 0"
|
VALUE "FileVersion", "1, 22, 1, 1"
|
||||||
VALUE "InternalName", "APPLEWIN"
|
VALUE "InternalName", "APPLEWIN"
|
||||||
VALUE "LegalCopyright", " 1994-2013 Michael O'Brien, Oliver Schmidt, Tom Charlesworth, Michael Pohoreski, Nick Westgate, Linards Ticmanis"
|
VALUE "LegalCopyright", " 1994-2013 Michael O'Brien, Oliver Schmidt, Tom Charlesworth, Michael Pohoreski, Nick Westgate, Linards Ticmanis"
|
||||||
VALUE "OriginalFilename", "APPLEWIN.EXE"
|
VALUE "OriginalFilename", "APPLEWIN.EXE"
|
||||||
VALUE "ProductName", "Apple //e Emulator"
|
VALUE "ProductName", "Apple //e Emulator"
|
||||||
VALUE "ProductVersion", "1, 22, 1, 0"
|
VALUE "ProductVersion", "1, 22, 1, 1"
|
||||||
END
|
END
|
||||||
END
|
END
|
||||||
BLOCK "VarFileInfo"
|
BLOCK "VarFileInfo"
|
||||||
|
@ -756,10 +756,11 @@ int APIENTRY WinMain (HINSTANCE passinstance, HINSTANCE, LPSTR lpCmdLine, int)
|
|||||||
else if(((strcmp(lpCmdLine, "-l") == 0) || (strcmp(lpCmdLine, "-log") == 0)) && (g_fh == NULL))
|
else if(((strcmp(lpCmdLine, "-l") == 0) || (strcmp(lpCmdLine, "-log") == 0)) && (g_fh == NULL))
|
||||||
{
|
{
|
||||||
g_fh = fopen("AppleWin.log", "a+t"); // Open log file (append & text mode)
|
g_fh = fopen("AppleWin.log", "a+t"); // Open log file (append & text mode)
|
||||||
|
setvbuf(g_fh, NULL, _IONBF, 0); // No buffering (so implicit fflush after every fprintf)
|
||||||
CHAR aDateStr[80], aTimeStr[80];
|
CHAR aDateStr[80], aTimeStr[80];
|
||||||
GetDateFormat(LOCALE_SYSTEM_DEFAULT, 0, NULL, NULL, (LPTSTR)aDateStr, sizeof(aDateStr));
|
GetDateFormat(LOCALE_SYSTEM_DEFAULT, 0, NULL, NULL, (LPTSTR)aDateStr, sizeof(aDateStr));
|
||||||
GetTimeFormat(LOCALE_SYSTEM_DEFAULT, 0, NULL, NULL, (LPTSTR)aTimeStr, sizeof(aTimeStr));
|
GetTimeFormat(LOCALE_SYSTEM_DEFAULT, 0, NULL, NULL, (LPTSTR)aTimeStr, sizeof(aTimeStr));
|
||||||
fprintf(g_fh,"*** Logging started: %s %s\n",aDateStr,aTimeStr);
|
fprintf(g_fh, "*** Logging started: %s %s\n", aDateStr, aTimeStr);
|
||||||
}
|
}
|
||||||
else if(strcmp(lpCmdLine, "-m") == 0)
|
else if(strcmp(lpCmdLine, "-m") == 0)
|
||||||
{
|
{
|
||||||
@ -867,6 +868,8 @@ int APIENTRY WinMain (HINSTANCE passinstance, HINSTANCE, LPSTR lpCmdLine, int)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
LogFileOutput("AppleWin version: %s\n", VERSIONSTRING);
|
||||||
|
|
||||||
#if DBG_CALC_FREQ
|
#if DBG_CALC_FREQ
|
||||||
QueryPerformanceFrequency((LARGE_INTEGER*)&g_nPerfFreq);
|
QueryPerformanceFrequency((LARGE_INTEGER*)&g_nPerfFreq);
|
||||||
if(g_fh) fprintf(g_fh, "Performance frequency = %d\n",g_nPerfFreq);
|
if(g_fh) fprintf(g_fh, "Performance frequency = %d\n",g_nPerfFreq);
|
||||||
@ -876,39 +879,57 @@ int APIENTRY WinMain (HINSTANCE passinstance, HINSTANCE, LPSTR lpCmdLine, int)
|
|||||||
|
|
||||||
// Initialize COM - so we can use CoCreateInstance
|
// Initialize COM - so we can use CoCreateInstance
|
||||||
// . NB. DSInit() & DIMouse::DirectInputInit are done when g_hFrameWindow is created (WM_CREATE)
|
// . NB. DSInit() & DIMouse::DirectInputInit are done when g_hFrameWindow is created (WM_CREATE)
|
||||||
CoInitializeEx(NULL, COINIT_APARTMENTTHREADED);
|
HRESULT hr = CoInitializeEx(NULL, COINIT_APARTMENTTHREADED);
|
||||||
|
LogFileOutput("Init: CoInitializeEx(), hr=0x%08X\n", hr);
|
||||||
|
|
||||||
bool bSysClkOK = SysClk_InitTimer();
|
const bool bSysClkOK = SysClk_InitTimer();
|
||||||
|
LogFileOutput("Init: SysClk_InitTimer(), res=%d\n", bSysClkOK ? 1:0);
|
||||||
#ifdef USE_SPEECH_API
|
#ifdef USE_SPEECH_API
|
||||||
if (g_bEnableSpeech)
|
if (g_bEnableSpeech)
|
||||||
{
|
{
|
||||||
bool bSpeechOK = g_Speech.Init();
|
const bool bSpeechOK = g_Speech.Init();
|
||||||
|
LogFileOutput("Init: SysClk_InitTimer(), res=%d\n", bSpeechOK ? 1:0);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// DO ONE-TIME INITIALIZATION
|
// DO ONE-TIME INITIALIZATION
|
||||||
g_hInstance = passinstance;
|
g_hInstance = passinstance;
|
||||||
GdiSetBatchLimit(512);
|
GdiSetBatchLimit(512);
|
||||||
|
LogFileOutput("Init: GdiSetBatchLimit()\n");
|
||||||
|
|
||||||
GetProgramDirectory();
|
GetProgramDirectory();
|
||||||
|
LogFileOutput("Init: GetProgramDirectory()\n");
|
||||||
|
|
||||||
if( g_bRegisterFileTypes )
|
if( g_bRegisterFileTypes )
|
||||||
{
|
{
|
||||||
RegisterExtensions();
|
RegisterExtensions();
|
||||||
|
LogFileOutput("Init: RegisterExtensions()\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
FrameRegisterClass();
|
FrameRegisterClass();
|
||||||
|
LogFileOutput("Init: FrameRegisterClass()\n");
|
||||||
|
|
||||||
ImageInitialize();
|
ImageInitialize();
|
||||||
|
LogFileOutput("Init: ImageInitialize()\n");
|
||||||
|
|
||||||
DiskInitialize();
|
DiskInitialize();
|
||||||
|
LogFileOutput("Init: DiskInitialize()\n");
|
||||||
|
|
||||||
CreateColorMixMap(); // For tv emulation mode
|
CreateColorMixMap(); // For tv emulation mode
|
||||||
|
LogFileOutput("Init: CreateColorMixMap()\n");
|
||||||
|
|
||||||
int nError = 0; // TODO: Show error MsgBox if we get a DiskInsert error
|
int nError = 0; // TODO: Show error MsgBox if we get a DiskInsert error
|
||||||
if(szImageName_drive1)
|
if(szImageName_drive1)
|
||||||
{
|
{
|
||||||
nError = DoDiskInsert(DRIVE_1, szImageName_drive1);
|
nError = DoDiskInsert(DRIVE_1, szImageName_drive1);
|
||||||
|
LogFileOutput("Init: DoDiskInsert(D1), res=%d\n", nError);
|
||||||
FrameRefreshStatus(DRAW_LEDS | DRAW_BUTTON_DRIVES);
|
FrameRefreshStatus(DRAW_LEDS | DRAW_BUTTON_DRIVES);
|
||||||
bBoot = true;
|
bBoot = true;
|
||||||
}
|
}
|
||||||
if(szImageName_drive2)
|
if(szImageName_drive2)
|
||||||
{
|
{
|
||||||
nError |= DoDiskInsert(DRIVE_2, szImageName_drive2);
|
nError |= DoDiskInsert(DRIVE_2, szImageName_drive2);
|
||||||
|
LogFileOutput("Init: DoDiskInsert(D2), res=%d\n", nError);
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
@ -918,17 +939,32 @@ int APIENTRY WinMain (HINSTANCE passinstance, HINSTANCE, LPSTR lpCmdLine, int)
|
|||||||
// DO INITIALIZATION THAT MUST BE REPEATED FOR A RESTART
|
// DO INITIALIZATION THAT MUST BE REPEATED FOR A RESTART
|
||||||
restart = 0;
|
restart = 0;
|
||||||
g_nAppMode = MODE_LOGO;
|
g_nAppMode = MODE_LOGO;
|
||||||
|
|
||||||
LoadConfiguration();
|
LoadConfiguration();
|
||||||
|
LogFileOutput("Init: LoadConfiguration()\n");
|
||||||
|
|
||||||
DebugInitialize();
|
DebugInitialize();
|
||||||
|
LogFileOutput("Init: DebugInitialize()\n");
|
||||||
|
|
||||||
JoyInitialize();
|
JoyInitialize();
|
||||||
|
LogFileOutput("Init: JoyInitialize()\n");
|
||||||
|
|
||||||
MemInitialize();
|
MemInitialize();
|
||||||
|
LogFileOutput("Init: MemInitialize()\n");
|
||||||
|
|
||||||
VideoInitialize(); // g_pFramebufferinfo been created now
|
VideoInitialize(); // g_pFramebufferinfo been created now
|
||||||
|
LogFileOutput("Init: VideoInitialize()\n");
|
||||||
|
|
||||||
FrameCreateWindow();
|
FrameCreateWindow();
|
||||||
|
LogFileOutput("Init: FrameCreateWindow()\n");
|
||||||
|
|
||||||
// PrintScrn support
|
// PrintScrn support
|
||||||
AppleWin_RegisterHotKeys(); // needs valid g_hFrameWindow
|
AppleWin_RegisterHotKeys(); // needs valid g_hFrameWindow
|
||||||
|
LogFileOutput("Init: AppleWin_RegisterHotKeys()\n");
|
||||||
|
|
||||||
// Need to test if it's safe to call ResetMachineState(). In the meantime, just call DiskReset():
|
// Need to test if it's safe to call ResetMachineState(). In the meantime, just call DiskReset():
|
||||||
DiskReset(); // Switch from a booting A][+ to a non-autostart A][, so need to turn off floppy motor
|
DiskReset(); // Switch from a booting A][+ to a non-autostart A][, so need to turn off floppy motor
|
||||||
|
LogFileOutput("Init: DiskReset()\n");
|
||||||
|
|
||||||
if (!bSysClkOK)
|
if (!bSysClkOK)
|
||||||
{
|
{
|
||||||
@ -943,7 +979,10 @@ int APIENTRY WinMain (HINSTANCE passinstance, HINSTANCE, LPSTR lpCmdLine, int)
|
|||||||
}
|
}
|
||||||
|
|
||||||
tfe_init();
|
tfe_init();
|
||||||
|
LogFileOutput("Init: tfe_init()\n");
|
||||||
|
|
||||||
Snapshot_Startup(); // Do this after everything has been init'ed
|
Snapshot_Startup(); // Do this after everything has been init'ed
|
||||||
|
LogFileOutput("Init: Snapshot_Startup()\n");
|
||||||
|
|
||||||
if(bSetFullScreen)
|
if(bSetFullScreen)
|
||||||
{
|
{
|
||||||
@ -958,24 +997,36 @@ int APIENTRY WinMain (HINSTANCE passinstance, HINSTANCE, LPSTR lpCmdLine, int)
|
|||||||
}
|
}
|
||||||
|
|
||||||
// ENTER THE MAIN MESSAGE LOOP
|
// ENTER THE MAIN MESSAGE LOOP
|
||||||
|
LogFileOutput("Init: EnterMessageLoop()\n");
|
||||||
EnterMessageLoop();
|
EnterMessageLoop();
|
||||||
|
LogFileOutput("Init: LeaveMessageLoop()\n");
|
||||||
|
|
||||||
MB_Reset();
|
MB_Reset();
|
||||||
|
LogFileOutput("Init: MB_Reset()\n");
|
||||||
|
|
||||||
sg_Mouse.Uninitialize(); // Maybe restarting due to switching slot-4 card from mouse to MB
|
sg_Mouse.Uninitialize(); // Maybe restarting due to switching slot-4 card from mouse to MB
|
||||||
|
LogFileOutput("Init: sg_Mouse.Uninitialize()\n");
|
||||||
}
|
}
|
||||||
while (restart);
|
while (restart);
|
||||||
|
|
||||||
// Release COM
|
// Release COM
|
||||||
DSUninit();
|
DSUninit();
|
||||||
|
LogFileOutput("Exit: DSUninit()\n");
|
||||||
|
|
||||||
SysClk_UninitTimer();
|
SysClk_UninitTimer();
|
||||||
|
LogFileOutput("Exit: SysClk_UninitTimer()\n");
|
||||||
|
|
||||||
CoUninitialize();
|
CoUninitialize();
|
||||||
|
LogFileOutput("Exit: CoUninitialize()\n");
|
||||||
|
|
||||||
tfe_shutdown();
|
tfe_shutdown();
|
||||||
|
LogFileOutput("Exit: tfe_shutdown()\n");
|
||||||
|
|
||||||
if (g_fh)
|
if (g_fh)
|
||||||
{
|
{
|
||||||
fprintf(g_fh,"*** Logging ended\n\n");
|
fprintf(g_fh,"*** Logging ended\n\n");
|
||||||
fclose(g_fh);
|
fclose(g_fh);
|
||||||
|
g_fh = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
RiffFinishWriteFile();
|
RiffFinishWriteFile();
|
||||||
|
@ -43,3 +43,19 @@ void LogOutput(LPCTSTR format, ...)
|
|||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------
|
//---------------------------------------------------------------------------
|
||||||
|
|
||||||
|
extern FILE* g_fh; // Filehandle for log file
|
||||||
|
|
||||||
|
void LogFileOutput(LPCTSTR format, ...)
|
||||||
|
{
|
||||||
|
if (!g_fh)
|
||||||
|
return;
|
||||||
|
|
||||||
|
TCHAR output[256];
|
||||||
|
|
||||||
|
va_list args;
|
||||||
|
va_start(args, format);
|
||||||
|
|
||||||
|
_vsntprintf(output, sizeof(output) - 1, format, args);
|
||||||
|
fprintf(g_fh, output);
|
||||||
|
}
|
||||||
|
@ -9,3 +9,4 @@
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
extern void LogOutput(LPCTSTR format, ...);
|
extern void LogOutput(LPCTSTR format, ...);
|
||||||
|
extern void LogFileOutput(LPCTSTR format, ...);
|
||||||
|
@ -109,7 +109,7 @@ void TfePcapFreeLibrary(void)
|
|||||||
{
|
{
|
||||||
if (pcap_library) {
|
if (pcap_library) {
|
||||||
if (!FreeLibrary(pcap_library)) {
|
if (!FreeLibrary(pcap_library)) {
|
||||||
if(g_fh) fprintf(g_fh, "FreeLibrary WPCAP.DLL failed!");
|
if(g_fh) fprintf(g_fh, "FreeLibrary WPCAP.DLL failed!\n");
|
||||||
}
|
}
|
||||||
pcap_library = NULL;
|
pcap_library = NULL;
|
||||||
|
|
||||||
@ -127,7 +127,7 @@ void TfePcapFreeLibrary(void)
|
|||||||
#define GET_PROC_ADDRESS_AND_TEST( _name_ ) \
|
#define GET_PROC_ADDRESS_AND_TEST( _name_ ) \
|
||||||
p_##_name_ = (_name_##_t) GetProcAddress(pcap_library, #_name_ ); \
|
p_##_name_ = (_name_##_t) GetProcAddress(pcap_library, #_name_ ); \
|
||||||
if (!p_##_name_ ) { \
|
if (!p_##_name_ ) { \
|
||||||
if(g_fh) fprintf(g_fh, "GetProcAddress " #_name_ " failed!"); \
|
if(g_fh) fprintf(g_fh, "GetProcAddress " #_name_ " failed!\n"); \
|
||||||
TfePcapFreeLibrary(); \
|
TfePcapFreeLibrary(); \
|
||||||
return FALSE; \
|
return FALSE; \
|
||||||
}
|
}
|
||||||
@ -139,7 +139,7 @@ BOOL TfePcapLoadLibrary(void)
|
|||||||
pcap_library = LoadLibrary("wpcap.dll");
|
pcap_library = LoadLibrary("wpcap.dll");
|
||||||
|
|
||||||
if (!pcap_library) {
|
if (!pcap_library) {
|
||||||
if(g_fh) fprintf(g_fh, "LoadLibrary WPCAP.DLL failed!" );
|
if(g_fh) fprintf(g_fh, "LoadLibrary WPCAP.DLL failed!\n" );
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user