mirror of
https://github.com/AppleWin/AppleWin.git
synced 2024-12-23 00:30:17 +00:00
added global: g_pAppTitle
removed: define TITLE indentation cleanup
This commit is contained in:
parent
dbbb5df19d
commit
9135e6e908
@ -31,6 +31,8 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
|
||||
char VERSIONSTRING[] = "xx.yy.zz.ww";
|
||||
|
||||
TCHAR *g_pAppTitle = TITLE_APPLE_2_E;
|
||||
|
||||
bool g_bApple2e = true;
|
||||
bool g_bApple2plus = true;
|
||||
|
||||
|
@ -2,6 +2,8 @@
|
||||
|
||||
extern char VERSIONSTRING[]; // Contructed in WinMain()
|
||||
|
||||
extern TCHAR *g_pAppTitle;
|
||||
|
||||
extern bool g_bApple2e;
|
||||
extern bool g_bApple2plus;
|
||||
|
||||
|
@ -56,7 +56,8 @@ enum AppMode_e
|
||||
#define TITLE_APPLE_2 TEXT("Apple ][ Emulator")
|
||||
#define TITLE_APPLE_2_PLUS TEXT("Apple ][+ 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_STEPPING TEXT("Stepping")
|
||||
|
||||
|
@ -371,8 +371,9 @@ int DiskInsert (int drive, LPCTSTR imagefilename, BOOL writeprotected, BOOL crea
|
||||
}
|
||||
|
||||
//===========================================================================
|
||||
BOOL DiskIsSpinning () {
|
||||
return floppymotoron;
|
||||
BOOL DiskIsSpinning ()
|
||||
{
|
||||
return floppymotoron;
|
||||
}
|
||||
|
||||
//===========================================================================
|
||||
@ -380,30 +381,34 @@ void DiskNotifyInvalidImage (LPCTSTR imagefilename,int error)
|
||||
{
|
||||
TCHAR buffer[MAX_PATH+128];
|
||||
|
||||
switch (error) {
|
||||
switch (error)
|
||||
{
|
||||
|
||||
case 1:
|
||||
wsprintf(buffer,
|
||||
TEXT("Unable to open the file %s."),
|
||||
(LPCTSTR)imagefilename);
|
||||
break;
|
||||
case 1:
|
||||
wsprintf(
|
||||
buffer,
|
||||
TEXT("Unable to open the file %s."),
|
||||
(LPCTSTR)imagefilename);
|
||||
break;
|
||||
|
||||
case 2:
|
||||
wsprintf(buffer,
|
||||
TEXT("Unable to use the file %s\nbecause the ")
|
||||
TEXT("disk image format is not recognized."),
|
||||
(LPCTSTR)imagefilename);
|
||||
break;
|
||||
case 2:
|
||||
wsprintf(
|
||||
buffer,
|
||||
TEXT("Unable to use the file %s\nbecause the ")
|
||||
TEXT("disk image format is not recognized."),
|
||||
(LPCTSTR)imagefilename);
|
||||
break;
|
||||
|
||||
default:
|
||||
default:
|
||||
// IGNORE OTHER ERRORS SILENTLY
|
||||
return;
|
||||
}
|
||||
|
||||
// IGNORE OTHER ERRORS SILENTLY
|
||||
return;
|
||||
}
|
||||
MessageBox(g_hFrameWindow,
|
||||
buffer,
|
||||
TITLE,
|
||||
MB_ICONEXCLAMATION | MB_SETFOREGROUND);
|
||||
MessageBox(
|
||||
g_hFrameWindow,
|
||||
buffer,
|
||||
g_pAppTitle,
|
||||
MB_ICONEXCLAMATION | MB_SETFOREGROUND);
|
||||
}
|
||||
|
||||
|
||||
|
@ -1159,49 +1159,73 @@ void SetUsingCursor (BOOL newvalue) {
|
||||
//
|
||||
|
||||
//===========================================================================
|
||||
void FrameCreateWindow () {
|
||||
int width = VIEWPORTCX + (VIEWPORTX<<1)
|
||||
+ BUTTONCX
|
||||
+ (GetSystemMetrics(SM_CXBORDER)<<1)
|
||||
+ 5;
|
||||
int height = VIEWPORTCY + (VIEWPORTY<<1)
|
||||
+ GetSystemMetrics(SM_CYBORDER)
|
||||
+ GetSystemMetrics(SM_CYCAPTION)
|
||||
+ 5;
|
||||
int xpos;
|
||||
if (!RegLoadValue(TEXT("Preferences"),TEXT("Window X-Position"),1,(DWORD *)&xpos))
|
||||
xpos = (GetSystemMetrics(SM_CXSCREEN)-width) >> 1;
|
||||
int ypos;
|
||||
if (!RegLoadValue(TEXT("Preferences"),TEXT("Window Y-Position"),1,(DWORD *)&ypos))
|
||||
ypos = (GetSystemMetrics(SM_CYSCREEN)-height) >> 1;
|
||||
g_hFrameWindow = CreateWindow(TEXT("APPLE2FRAME"),
|
||||
g_bApple2e ? TITLE
|
||||
: (g_bApple2plus ? TEXT("Apple ][+ Emulator")
|
||||
: TEXT("Apple ][ Emulator")),
|
||||
WS_OVERLAPPED | WS_CAPTION | WS_SYSMENU |
|
||||
WS_MINIMIZEBOX | WS_VISIBLE,
|
||||
xpos,ypos,width,height,
|
||||
HWND_DESKTOP,(HMENU)0,instance,NULL);
|
||||
InitCommonControls();
|
||||
tooltipwindow = CreateWindow(TOOLTIPS_CLASS,NULL,TTS_ALWAYSTIP,
|
||||
CW_USEDEFAULT,CW_USEDEFAULT,CW_USEDEFAULT,CW_USEDEFAULT,
|
||||
g_hFrameWindow,(HMENU)0,instance,NULL);
|
||||
TOOLINFO toolinfo;
|
||||
toolinfo.cbSize = sizeof(toolinfo);
|
||||
toolinfo.uFlags = TTF_CENTERTIP;
|
||||
toolinfo.hwnd = g_hFrameWindow;
|
||||
toolinfo.hinst = instance;
|
||||
toolinfo.lpszText = LPSTR_TEXTCALLBACK;
|
||||
toolinfo.rect.left = BUTTONX;
|
||||
toolinfo.rect.right = toolinfo.rect.left+BUTTONCX+1;
|
||||
toolinfo.uId = 0;
|
||||
toolinfo.rect.top = BUTTONY+BTN_DRIVE1*BUTTONCY+1;
|
||||
toolinfo.rect.bottom = toolinfo.rect.top+BUTTONCY;
|
||||
SendMessage(tooltipwindow,TTM_ADDTOOL,0,(LPARAM)&toolinfo);
|
||||
toolinfo.uId = 1;
|
||||
toolinfo.rect.top = BUTTONY+BTN_DRIVE2*BUTTONCY+1;
|
||||
toolinfo.rect.bottom = toolinfo.rect.top+BUTTONCY;
|
||||
SendMessage(tooltipwindow,TTM_ADDTOOL,0,(LPARAM)&toolinfo);
|
||||
void FrameCreateWindow ()
|
||||
{
|
||||
int width = VIEWPORTCX + (VIEWPORTX<<1)
|
||||
+ BUTTONCX
|
||||
+ (GetSystemMetrics(SM_CXBORDER)<<1)
|
||||
+ 5;
|
||||
int height = VIEWPORTCY + (VIEWPORTY<<1)
|
||||
+ GetSystemMetrics(SM_CYBORDER)
|
||||
+ GetSystemMetrics(SM_CYCAPTION)
|
||||
+ 5;
|
||||
int xpos;
|
||||
|
||||
if (!RegLoadValue(TEXT("Preferences"),TEXT("Window X-Position"),1,(DWORD *)&xpos))
|
||||
xpos = (GetSystemMetrics(SM_CXSCREEN)-width) >> 1;
|
||||
|
||||
int ypos;
|
||||
if (!RegLoadValue(TEXT("Preferences"),TEXT("Window Y-Position"),1,(DWORD *)&ypos))
|
||||
ypos = (GetSystemMetrics(SM_CYSCREEN)-height) >> 1;
|
||||
|
||||
if (g_bApple2e)
|
||||
{
|
||||
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_MINIMIZEBOX | WS_VISIBLE,
|
||||
xpos,ypos,width,height,
|
||||
HWND_DESKTOP,(HMENU)0,instance,NULL );
|
||||
|
||||
|
||||
InitCommonControls();
|
||||
tooltipwindow = CreateWindow(
|
||||
TOOLTIPS_CLASS,NULL,TTS_ALWAYSTIP,
|
||||
CW_USEDEFAULT,CW_USEDEFAULT,CW_USEDEFAULT,CW_USEDEFAULT,
|
||||
g_hFrameWindow,(HMENU)0,instance,NULL );
|
||||
|
||||
TOOLINFO toolinfo;
|
||||
toolinfo.cbSize = sizeof(toolinfo);
|
||||
toolinfo.uFlags = TTF_CENTERTIP;
|
||||
toolinfo.hwnd = g_hFrameWindow;
|
||||
toolinfo.hinst = instance;
|
||||
toolinfo.lpszText = LPSTR_TEXTCALLBACK;
|
||||
toolinfo.rect.left = BUTTONX;
|
||||
toolinfo.rect.right = toolinfo.rect.left+BUTTONCX+1;
|
||||
toolinfo.uId = 0;
|
||||
toolinfo.rect.top = BUTTONY+BTN_DRIVE1*BUTTONCY+1;
|
||||
toolinfo.rect.bottom = toolinfo.rect.top+BUTTONCY;
|
||||
SendMessage(tooltipwindow,TTM_ADDTOOL,0,(LPARAM)&toolinfo);
|
||||
toolinfo.uId = 1;
|
||||
toolinfo.rect.top = BUTTONY+BTN_DRIVE2*BUTTONCY+1;
|
||||
toolinfo.rect.bottom = toolinfo.rect.top+BUTTONCY;
|
||||
SendMessage(tooltipwindow,TTM_ADDTOOL,0,(LPARAM)&toolinfo);
|
||||
}
|
||||
|
||||
//===========================================================================
|
||||
|
@ -865,25 +865,28 @@ void MemInitialize () {
|
||||
memimage = (LPBYTE)VirtualAlloc(NULL,
|
||||
MAX(0x30000,MAXIMAGES*0x10000),
|
||||
MEM_RESERVE,PAGE_NOACCESS);
|
||||
if ((!memaux) || (!memdirty) || (!memimage) || (!memmain) || (!memrom)) {
|
||||
MessageBox(GetDesktopWindow(),
|
||||
TEXT("The emulator was unable to allocate the memory it ")
|
||||
TEXT("requires. Further execution is not possible."),
|
||||
TITLE,
|
||||
MB_ICONSTOP | MB_SETFOREGROUND);
|
||||
ExitProcess(1);
|
||||
}
|
||||
{
|
||||
LPVOID newloc = VirtualAlloc(memimage,0x30000,MEM_COMMIT,PAGE_READWRITE);
|
||||
if (newloc != memimage)
|
||||
MessageBox(GetDesktopWindow(),
|
||||
TEXT("The emulator has detected a bug in your operating ")
|
||||
TEXT("system. While changing the attributes of a memory ")
|
||||
TEXT("object, the operating system also changed its ")
|
||||
TEXT("location."),
|
||||
TITLE,
|
||||
MB_ICONEXCLAMATION | MB_SETFOREGROUND);
|
||||
}
|
||||
|
||||
if ((!memaux) || (!memdirty) || (!memimage) || (!memmain) || (!memrom))
|
||||
{
|
||||
MessageBox(
|
||||
GetDesktopWindow(),
|
||||
TEXT("The emulator was unable to allocate the memory it ")
|
||||
TEXT("requires. Further execution is not possible."),
|
||||
g_pAppTitle,
|
||||
MB_ICONSTOP | MB_SETFOREGROUND);
|
||||
ExitProcess(1);
|
||||
}
|
||||
|
||||
LPVOID newloc = VirtualAlloc(memimage,0x30000,MEM_COMMIT,PAGE_READWRITE);
|
||||
if (newloc != memimage)
|
||||
MessageBox(
|
||||
GetDesktopWindow(),
|
||||
TEXT("The emulator has detected a bug in your operating ")
|
||||
TEXT("system. While changing the attributes of a memory ")
|
||||
TEXT("object, the operating system also changed its ")
|
||||
TEXT("location."),
|
||||
g_pAppTitle,
|
||||
MB_ICONEXCLAMATION | MB_SETFOREGROUND);
|
||||
|
||||
#ifdef RAMWORKS
|
||||
// allocate memory for RAMWorks III - up to 8MB
|
||||
@ -893,7 +896,7 @@ void MemInitialize () {
|
||||
i++;
|
||||
#endif
|
||||
|
||||
// READ THE APPLE FIRMWARE ROMS INTO THE ROM IMAGE
|
||||
// READ THE APPLE FIRMWARE ROMS INTO THE ROM IMAGE
|
||||
const UINT ROM_SIZE = 0x5000; // HACK: Magic # -- $C000..$FFFF = 4K .. why 5K?
|
||||
|
||||
HRSRC hResInfo =
|
||||
@ -905,18 +908,22 @@ void MemInitialize () {
|
||||
|
||||
if(hResInfo == NULL)
|
||||
{
|
||||
TCHAR sRomFileName[ 128 ];
|
||||
_tcscpy( sRomFileName, g_bApple2e ? TEXT("APPLE2E.ROM")
|
||||
: (g_bApple2plus ? TEXT("APPLE2PLUS.ROM")
|
||||
: TEXT("APPLE2ORIG.ROM")));
|
||||
TCHAR sRomFileName[ MAX_PATH ];
|
||||
_tcscpy( sRomFileName,
|
||||
g_bApple2e
|
||||
? TEXT("APPLE2E.ROM")
|
||||
: (g_bApple2plus
|
||||
? TEXT("APPLE2PLUS.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 );
|
||||
|
||||
MessageBox(GetDesktopWindow(),
|
||||
sText,
|
||||
TITLE,
|
||||
MB_ICONSTOP | MB_SETFOREGROUND);
|
||||
MessageBox(
|
||||
GetDesktopWindow(),
|
||||
sText,
|
||||
g_pAppTitle,
|
||||
MB_ICONSTOP | MB_SETFOREGROUND);
|
||||
ExitProcess(1);
|
||||
}
|
||||
|
||||
@ -929,41 +936,39 @@ void MemInitialize () {
|
||||
return;
|
||||
|
||||
BYTE* pData = (BYTE*) LockResource(hResData); // NB. Don't need to unlock resource
|
||||
if(pData == NULL)
|
||||
if (pData == NULL)
|
||||
return;
|
||||
|
||||
memcpy(memrom, pData, ROM_SIZE);
|
||||
|
||||
// TODO/FIXME: HACK! REMOVE A WAIT ROUTINE FROM THE DISK CONTROLLER'S FIRMWARE
|
||||
{
|
||||
*(memrom+0x064C) = 0xA9;
|
||||
*(memrom+0x064D) = 0x00;
|
||||
*(memrom+0x064E) = 0xEA;
|
||||
}
|
||||
// TODO/FIXME: HACK! REMOVE A WAIT ROUTINE FROM THE DISK CONTROLLER'S FIRMWARE
|
||||
*(memrom+0x064C) = 0xA9;
|
||||
*(memrom+0x064D) = 0x00;
|
||||
*(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
|
||||
|
||||
MemReset();
|
||||
MemReset();
|
||||
}
|
||||
|
||||
//===========================================================================
|
||||
|
||||
// Call by:
|
||||
// Called by:
|
||||
// . ResetMachineState() eg. Power-cycle ('Apple-Go' button)
|
||||
// . Snapshot_LoadState()
|
||||
void MemReset ()
|
||||
{
|
||||
// TURN OFF FAST PAGING IF IT IS CURRENTLY ACTIVE
|
||||
MemSetFastPaging(0);
|
||||
// TURN OFF FAST PAGING IF IT IS CURRENTLY ACTIVE
|
||||
MemSetFastPaging(0);
|
||||
|
||||
// INITIALIZE THE PAGING TABLES
|
||||
ZeroMemory(memshadow,MAXIMAGES*256*sizeof(LPBYTE));
|
||||
ZeroMemory(memwrite ,MAXIMAGES*256*sizeof(LPBYTE));
|
||||
// INITIALIZE THE PAGING TABLES
|
||||
ZeroMemory(memshadow,MAXIMAGES*256*sizeof(LPBYTE));
|
||||
ZeroMemory(memwrite ,MAXIMAGES*256*sizeof(LPBYTE));
|
||||
|
||||
// INITIALIZE THE RAM IMAGES
|
||||
ZeroMemory(memaux ,0x10000);
|
||||
// INITIALIZE THE RAM IMAGES
|
||||
ZeroMemory(memaux ,0x10000);
|
||||
|
||||
ZeroMemory(memmain,0x10000);
|
||||
ZeroMemory(memmain,0x10000);
|
||||
|
||||
int iByte;
|
||||
|
||||
@ -979,16 +984,16 @@ void MemReset ()
|
||||
}
|
||||
}
|
||||
|
||||
// SET UP THE MEMORY IMAGE
|
||||
mem = memimage;
|
||||
image = 0;
|
||||
// SET UP THE MEMORY IMAGE
|
||||
mem = memimage;
|
||||
image = 0;
|
||||
|
||||
// INITIALIZE THE CPU
|
||||
CpuInitialize();
|
||||
// INITIALIZE THE CPU
|
||||
CpuInitialize();
|
||||
|
||||
// INITIALIZE PAGING, FILLING IN THE 64K MEMORY IMAGE
|
||||
ResetPaging(1);
|
||||
regs.bRESET = 1;
|
||||
// INITIALIZE PAGING, FILLING IN THE 64K MEMORY IMAGE
|
||||
ResetPaging(1);
|
||||
regs.bRESET = 1;
|
||||
}
|
||||
|
||||
//===========================================================================
|
||||
|
Loading…
Reference in New Issue
Block a user