added global: g_pAppTitle

removed: define TITLE
indentation cleanup
This commit is contained in:
mpohoreski 2006-06-27 02:34:46 +00:00
parent dbbb5df19d
commit 9135e6e908
6 changed files with 160 additions and 121 deletions

View File

@ -31,6 +31,8 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
char VERSIONSTRING[] = "xx.yy.zz.ww"; char VERSIONSTRING[] = "xx.yy.zz.ww";
TCHAR *g_pAppTitle = TITLE_APPLE_2_E;
bool g_bApple2e = true; bool g_bApple2e = true;
bool g_bApple2plus = true; bool g_bApple2plus = true;

View File

@ -2,6 +2,8 @@
extern char VERSIONSTRING[]; // Contructed in WinMain() extern char VERSIONSTRING[]; // Contructed in WinMain()
extern TCHAR *g_pAppTitle;
extern bool g_bApple2e; extern bool g_bApple2e;
extern bool g_bApple2plus; extern bool g_bApple2plus;

View File

@ -56,7 +56,8 @@ enum AppMode_e
#define TITLE_APPLE_2 TEXT("Apple ][ Emulator") #define TITLE_APPLE_2 TEXT("Apple ][ Emulator")
#define TITLE_APPLE_2_PLUS TEXT("Apple ][+ Emulator") #define TITLE_APPLE_2_PLUS TEXT("Apple ][+ Emulator")
#define TITLE_APPLE_2_E TEXT("Apple //e Emulator") #define TITLE_APPLE_2_E TEXT("Apple //e Emulator")
#define TITLE TITLE_APPLE_2_E // #define TITLE TITLE_APPLE_2_E
#define TITLE_PAUSED TEXT(" Paused ") #define TITLE_PAUSED TEXT(" Paused ")
#define TITLE_STEPPING TEXT("Stepping") #define TITLE_STEPPING TEXT("Stepping")

View File

@ -371,7 +371,8 @@ int DiskInsert (int drive, LPCTSTR imagefilename, BOOL writeprotected, BOOL crea
} }
//=========================================================================== //===========================================================================
BOOL DiskIsSpinning () { BOOL DiskIsSpinning ()
{
return floppymotoron; return floppymotoron;
} }
@ -380,29 +381,33 @@ void DiskNotifyInvalidImage (LPCTSTR imagefilename,int error)
{ {
TCHAR buffer[MAX_PATH+128]; TCHAR buffer[MAX_PATH+128];
switch (error) { switch (error)
{
case 1: case 1:
wsprintf(buffer, wsprintf(
buffer,
TEXT("Unable to open the file %s."), TEXT("Unable to open the file %s."),
(LPCTSTR)imagefilename); (LPCTSTR)imagefilename);
break; break;
case 2: case 2:
wsprintf(buffer, wsprintf(
buffer,
TEXT("Unable to use the file %s\nbecause the ") TEXT("Unable to use the file %s\nbecause the ")
TEXT("disk image format is not recognized."), TEXT("disk image format is not recognized."),
(LPCTSTR)imagefilename); (LPCTSTR)imagefilename);
break; break;
default: default:
// IGNORE OTHER ERRORS SILENTLY // IGNORE OTHER ERRORS SILENTLY
return; return;
} }
MessageBox(g_hFrameWindow,
MessageBox(
g_hFrameWindow,
buffer, buffer,
TITLE, g_pAppTitle,
MB_ICONEXCLAMATION | MB_SETFOREGROUND); MB_ICONEXCLAMATION | MB_SETFOREGROUND);
} }

View File

@ -1159,7 +1159,8 @@ void SetUsingCursor (BOOL newvalue) {
// //
//=========================================================================== //===========================================================================
void FrameCreateWindow () { void FrameCreateWindow ()
{
int width = VIEWPORTCX + (VIEWPORTX<<1) int width = VIEWPORTCX + (VIEWPORTX<<1)
+ BUTTONCX + BUTTONCX
+ (GetSystemMetrics(SM_CXBORDER)<<1) + (GetSystemMetrics(SM_CXBORDER)<<1)
@ -1169,23 +1170,46 @@ void FrameCreateWindow () {
+ GetSystemMetrics(SM_CYCAPTION) + GetSystemMetrics(SM_CYCAPTION)
+ 5; + 5;
int xpos; int xpos;
if (!RegLoadValue(TEXT("Preferences"),TEXT("Window X-Position"),1,(DWORD *)&xpos)) if (!RegLoadValue(TEXT("Preferences"),TEXT("Window X-Position"),1,(DWORD *)&xpos))
xpos = (GetSystemMetrics(SM_CXSCREEN)-width) >> 1; xpos = (GetSystemMetrics(SM_CXSCREEN)-width) >> 1;
int ypos; int ypos;
if (!RegLoadValue(TEXT("Preferences"),TEXT("Window Y-Position"),1,(DWORD *)&ypos)) if (!RegLoadValue(TEXT("Preferences"),TEXT("Window Y-Position"),1,(DWORD *)&ypos))
ypos = (GetSystemMetrics(SM_CYSCREEN)-height) >> 1; ypos = (GetSystemMetrics(SM_CYSCREEN)-height) >> 1;
g_hFrameWindow = CreateWindow(TEXT("APPLE2FRAME"),
g_bApple2e ? TITLE if (g_bApple2e)
: (g_bApple2plus ? TEXT("Apple ][+ Emulator") {
: TEXT("Apple ][ Emulator")), g_pAppTitle = TITLE_APPLE_2_E;
}
else
{
if (g_bApple2plus)
g_pAppTitle = TITLE_APPLE_2_PLUS;
else
g_pAppTitle = TITLE_APPLE_2;
}
g_hFrameWindow = CreateWindow(
TEXT("APPLE2FRAME"),
// g_bApple2e
// ? TITLE_APPLE_2_E
// : (g_bApple2plus
// ? TITLE_APPLE_2_PLUS
// : TITLE_APPLE_2),
g_pAppTitle,
WS_OVERLAPPED | WS_CAPTION | WS_SYSMENU | WS_OVERLAPPED | WS_CAPTION | WS_SYSMENU |
WS_MINIMIZEBOX | WS_VISIBLE, WS_MINIMIZEBOX | WS_VISIBLE,
xpos,ypos,width,height, xpos,ypos,width,height,
HWND_DESKTOP,(HMENU)0,instance,NULL); HWND_DESKTOP,(HMENU)0,instance,NULL );
InitCommonControls(); InitCommonControls();
tooltipwindow = CreateWindow(TOOLTIPS_CLASS,NULL,TTS_ALWAYSTIP, tooltipwindow = CreateWindow(
TOOLTIPS_CLASS,NULL,TTS_ALWAYSTIP,
CW_USEDEFAULT,CW_USEDEFAULT,CW_USEDEFAULT,CW_USEDEFAULT, CW_USEDEFAULT,CW_USEDEFAULT,CW_USEDEFAULT,CW_USEDEFAULT,
g_hFrameWindow,(HMENU)0,instance,NULL); g_hFrameWindow,(HMENU)0,instance,NULL );
TOOLINFO toolinfo; TOOLINFO toolinfo;
toolinfo.cbSize = sizeof(toolinfo); toolinfo.cbSize = sizeof(toolinfo);
toolinfo.uFlags = TTF_CENTERTIP; toolinfo.uFlags = TTF_CENTERTIP;

View File

@ -865,25 +865,28 @@ void MemInitialize () {
memimage = (LPBYTE)VirtualAlloc(NULL, memimage = (LPBYTE)VirtualAlloc(NULL,
MAX(0x30000,MAXIMAGES*0x10000), MAX(0x30000,MAXIMAGES*0x10000),
MEM_RESERVE,PAGE_NOACCESS); MEM_RESERVE,PAGE_NOACCESS);
if ((!memaux) || (!memdirty) || (!memimage) || (!memmain) || (!memrom)) {
MessageBox(GetDesktopWindow(), if ((!memaux) || (!memdirty) || (!memimage) || (!memmain) || (!memrom))
{
MessageBox(
GetDesktopWindow(),
TEXT("The emulator was unable to allocate the memory it ") TEXT("The emulator was unable to allocate the memory it ")
TEXT("requires. Further execution is not possible."), TEXT("requires. Further execution is not possible."),
TITLE, g_pAppTitle,
MB_ICONSTOP | MB_SETFOREGROUND); MB_ICONSTOP | MB_SETFOREGROUND);
ExitProcess(1); ExitProcess(1);
} }
{
LPVOID newloc = VirtualAlloc(memimage,0x30000,MEM_COMMIT,PAGE_READWRITE); LPVOID newloc = VirtualAlloc(memimage,0x30000,MEM_COMMIT,PAGE_READWRITE);
if (newloc != memimage) if (newloc != memimage)
MessageBox(GetDesktopWindow(), MessageBox(
GetDesktopWindow(),
TEXT("The emulator has detected a bug in your operating ") TEXT("The emulator has detected a bug in your operating ")
TEXT("system. While changing the attributes of a memory ") TEXT("system. While changing the attributes of a memory ")
TEXT("object, the operating system also changed its ") TEXT("object, the operating system also changed its ")
TEXT("location."), TEXT("location."),
TITLE, g_pAppTitle,
MB_ICONEXCLAMATION | MB_SETFOREGROUND); MB_ICONEXCLAMATION | MB_SETFOREGROUND);
}
#ifdef RAMWORKS #ifdef RAMWORKS
// allocate memory for RAMWorks III - up to 8MB // allocate memory for RAMWorks III - up to 8MB
@ -905,17 +908,21 @@ void MemInitialize () {
if(hResInfo == NULL) if(hResInfo == NULL)
{ {
TCHAR sRomFileName[ 128 ]; TCHAR sRomFileName[ MAX_PATH ];
_tcscpy( sRomFileName, g_bApple2e ? TEXT("APPLE2E.ROM") _tcscpy( sRomFileName,
: (g_bApple2plus ? TEXT("APPLE2PLUS.ROM") g_bApple2e
? TEXT("APPLE2E.ROM")
: (g_bApple2plus
? TEXT("APPLE2PLUS.ROM")
: TEXT("APPLE2ORIG.ROM"))); : TEXT("APPLE2ORIG.ROM")));
TCHAR sText[ 256 ]; TCHAR sText[ MAX_PATH ];
wsprintf( sText, TEXT("Unable to open the required firmware ROM data file.\n\nFile: %s."), sRomFileName ); wsprintf( sText, TEXT("Unable to open the required firmware ROM data file.\n\nFile: %s."), sRomFileName );
MessageBox(GetDesktopWindow(), MessageBox(
GetDesktopWindow(),
sText, sText,
TITLE, g_pAppTitle,
MB_ICONSTOP | MB_SETFOREGROUND); MB_ICONSTOP | MB_SETFOREGROUND);
ExitProcess(1); ExitProcess(1);
} }
@ -929,17 +936,15 @@ void MemInitialize () {
return; return;
BYTE* pData = (BYTE*) LockResource(hResData); // NB. Don't need to unlock resource BYTE* pData = (BYTE*) LockResource(hResData); // NB. Don't need to unlock resource
if(pData == NULL) if (pData == NULL)
return; return;
memcpy(memrom, pData, ROM_SIZE); memcpy(memrom, pData, ROM_SIZE);
// TODO/FIXME: HACK! REMOVE A WAIT ROUTINE FROM THE DISK CONTROLLER'S FIRMWARE // TODO/FIXME: HACK! REMOVE A WAIT ROUTINE FROM THE DISK CONTROLLER'S FIRMWARE
{
*(memrom+0x064C) = 0xA9; *(memrom+0x064C) = 0xA9;
*(memrom+0x064D) = 0x00; *(memrom+0x064D) = 0x00;
*(memrom+0x064E) = 0xEA; *(memrom+0x064E) = 0xEA;
}
HD_Load_Rom(memrom); // HDD f/w gets loaded to $C700 HD_Load_Rom(memrom); // HDD f/w gets loaded to $C700
@ -948,7 +953,7 @@ void MemInitialize () {
//=========================================================================== //===========================================================================
// Call by: // Called by:
// . ResetMachineState() eg. Power-cycle ('Apple-Go' button) // . ResetMachineState() eg. Power-cycle ('Apple-Go' button)
// . Snapshot_LoadState() // . Snapshot_LoadState()
void MemReset () void MemReset ()