mirror of
https://github.com/AppleWin/AppleWin.git
synced 2024-12-29 08:30:04 +00:00
Renamed globals to match coding convention:
g_bApple2e g_bApple2plus g_sProgramDir
This commit is contained in:
parent
566a935013
commit
18b78ae9d5
@ -31,8 +31,8 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
|
||||
char VERSIONSTRING[] = "xx.yy.zz.ww";
|
||||
|
||||
bool apple2e = true;
|
||||
bool apple2plus = true;
|
||||
bool g_bApple2e = true;
|
||||
bool g_bApple2plus = true;
|
||||
|
||||
BOOL behind = 0; // Redundant
|
||||
DWORD cumulativecycles = 0; // Wraps after ~1hr 9mins
|
||||
@ -48,7 +48,8 @@ AppMode_e g_nAppMode = MODE_LOGO;
|
||||
|
||||
static int lastmode = MODE_LOGO;
|
||||
DWORD needsprecision = 0; // Redundant
|
||||
TCHAR progdir[MAX_PATH] = TEXT("");
|
||||
TCHAR g_sProgramDir[MAX_PATH] = TEXT("");
|
||||
TCHAR g_sCurrentDir[MAX_PATH] = TEXT(""); // Also Starting Dir
|
||||
BOOL resettiming = 0; // Redundant
|
||||
BOOL restart = 0;
|
||||
|
||||
@ -349,13 +350,13 @@ void EnterMessageLoop ()
|
||||
|
||||
//===========================================================================
|
||||
void GetProgramDirectory () {
|
||||
GetModuleFileName((HINSTANCE)0,progdir,MAX_PATH);
|
||||
progdir[MAX_PATH-1] = 0;
|
||||
int loop = _tcslen(progdir);
|
||||
GetModuleFileName((HINSTANCE)0,g_sProgramDir,MAX_PATH);
|
||||
g_sProgramDir[MAX_PATH-1] = 0;
|
||||
int loop = _tcslen(g_sProgramDir);
|
||||
while (loop--)
|
||||
if ((progdir[loop] == TEXT('\\')) ||
|
||||
(progdir[loop] == TEXT(':'))) {
|
||||
progdir[loop+1] = 0;
|
||||
if ((g_sProgramDir[loop] == TEXT('\\')) ||
|
||||
(g_sProgramDir[loop] == TEXT(':'))) {
|
||||
g_sProgramDir[loop+1] = 0;
|
||||
break;
|
||||
}
|
||||
}
|
||||
@ -364,8 +365,8 @@ void GetProgramDirectory () {
|
||||
void LoadConfiguration () {
|
||||
DWORD comptype;
|
||||
LOAD(TEXT("Computer Emulation"),&comptype);
|
||||
apple2e = (comptype == 2);
|
||||
apple2plus = (comptype == 1);
|
||||
g_bApple2e = (comptype == 2);
|
||||
g_bApple2plus = (comptype == 1);
|
||||
LOAD(TEXT("Joystick 0 Emulation"),&joytype[0]);
|
||||
LOAD(TEXT("Joystick 1 Emulation"),&joytype[1]);
|
||||
LOAD(TEXT("Sound Emulation") ,&soundtype);
|
||||
@ -415,13 +416,9 @@ void LoadConfiguration () {
|
||||
RegLoadString(TEXT("Configuration"),TEXT(REGVALUE_SAVESTATE_FILENAME),1,szFilename,sizeof(szFilename));
|
||||
Snapshot_SetFilename(szFilename); // If not in Registry than default will be used
|
||||
|
||||
//
|
||||
|
||||
TCHAR szDirectory[MAX_PATH] = TEXT("");
|
||||
|
||||
RegLoadString(TEXT("Preferences"),TEXT("Starting Directory"),1,szDirectory,MAX_PATH);
|
||||
|
||||
SetCurrentDirectory(szDirectory);
|
||||
// Current/Starting Dir is the "root" of where the user keeps his disk images
|
||||
RegLoadString(TEXT("Preferences"),REGVALUE_PREF_START_DIR,1,g_sCurrentDir,MAX_PATH);
|
||||
SetCurrentDirectory(g_sCurrentDir);
|
||||
|
||||
char szUthernetInt[MAX_PATH] = {0};
|
||||
RegLoadString(TEXT("Configuration"),TEXT("Uthernet Interface"),1,szUthernetInt,MAX_PATH);
|
||||
|
@ -2,8 +2,8 @@
|
||||
|
||||
extern char VERSIONSTRING[]; // Contructed in WinMain()
|
||||
|
||||
extern bool apple2e;
|
||||
extern bool apple2plus;
|
||||
extern bool g_bApple2e;
|
||||
extern bool g_bApple2plus;
|
||||
|
||||
extern BOOL behind;
|
||||
extern DWORD cumulativecycles;
|
||||
@ -15,7 +15,9 @@ extern HINSTANCE instance;
|
||||
extern AppMode_e g_nAppMode;
|
||||
|
||||
extern DWORD needsprecision;
|
||||
extern TCHAR progdir[MAX_PATH];
|
||||
extern TCHAR g_sProgramDir[MAX_PATH];
|
||||
extern TCHAR g_sCurrentDir[MAX_PATH];
|
||||
|
||||
extern BOOL resettiming;
|
||||
extern BOOL restart;
|
||||
|
||||
|
@ -848,7 +848,7 @@ static DWORD InternalCpuExecute (DWORD totalcycles)
|
||||
WORD base;
|
||||
bool bBreakOnInvalid = false;
|
||||
|
||||
if (apple2e)
|
||||
if (g_bApple2e)
|
||||
{
|
||||
do
|
||||
{
|
||||
@ -1583,7 +1583,7 @@ DWORD CpuExecute (DWORD cycles)
|
||||
|
||||
// IF WE ARE USING THE EXTERNAL 6502 64K EMULATOR, MARK PAGES $40-$BF AS
|
||||
// DIRTY, BECAUSE IT DOES NOT KEEP TRACK OF DIRTY PAGES IN THAT RANGE.
|
||||
if ((!apple2e) && cpuexecutefunc[1])
|
||||
if ((!g_bApple2e) && cpuexecutefunc[1])
|
||||
{
|
||||
int page = 0xC0;
|
||||
while (page-- > 0x40)
|
||||
@ -1630,18 +1630,18 @@ void CpuInitialize () {
|
||||
|
||||
if (mem) {
|
||||
TCHAR filename[MAX_PATH];
|
||||
_tcscpy(filename,progdir);
|
||||
_tcscpy(filename,g_sProgramDir);
|
||||
_tcscat(filename,TEXT("65C02C.DLL"));
|
||||
cpulibrary[CPU_COMPILING] = LoadLibrary(filename);
|
||||
_tcscpy(filename,progdir);
|
||||
_tcscat(filename,apple2e ? TEXT("65C02.DLL") : TEXT("6502.DLL"));
|
||||
_tcscpy(filename,g_sProgramDir);
|
||||
_tcscat(filename,g_bApple2e ? TEXT("65C02.DLL") : TEXT("6502.DLL"));
|
||||
cpulibrary[CPU_INTERPRETIVE] = LoadLibrary(filename);
|
||||
if (!cpulibrary[CPU_INTERPRETIVE]) {
|
||||
_tcscpy(filename,progdir);
|
||||
_tcscpy(filename,g_sProgramDir);
|
||||
_tcscat(filename,TEXT("65C02.DLL"));
|
||||
cpulibrary[CPU_INTERPRETIVE] = LoadLibrary(filename);
|
||||
}
|
||||
_tcscpy(filename,progdir);
|
||||
_tcscpy(filename,g_sProgramDir);
|
||||
_tcscat(filename,TEXT("65C02P.DLL"));
|
||||
cpulibrary[CPU_FASTPAGING] = LoadLibrary(filename);
|
||||
if (!cpulibrary[CPU_COMPILING])
|
||||
|
@ -57,6 +57,7 @@ enum AppMode_e
|
||||
#define LOAD(a,b) RegLoadValue(TEXT("Configuration"),a,1,b)
|
||||
#define SAVE(a,b) RegSaveValue(TEXT("Configuration"),a,1,b)
|
||||
|
||||
// Configuration
|
||||
#define REGVALUE_SPKR_VOLUME "Speaker Volume"
|
||||
#define REGVALUE_MB_VOLUME "Mockingboard Volume"
|
||||
#define REGVALUE_SOUNDCARD_TYPE "Soundcard Type"
|
||||
@ -69,6 +70,9 @@ enum AppMode_e
|
||||
#define REGVALUE_PDL_XTRIM "PDL X-Trim"
|
||||
#define REGVALUE_PDL_YTRIM "PDL Y-Trim"
|
||||
|
||||
// Preferences
|
||||
#define REGVALUE_PREF_START_DIR TEXT("Starting Directory")
|
||||
|
||||
#define WM_USER_BENCHMARK WM_USER+1
|
||||
#define WM_USER_RESTART WM_USER+2
|
||||
#define WM_USER_SAVESTATE WM_USER+3
|
||||
|
@ -156,7 +156,7 @@ void KeybQueueKeypress (int key, BOOL bASCII)
|
||||
if (key > 0x7F)
|
||||
return;
|
||||
|
||||
if (apple2e)
|
||||
if (g_bApple2e)
|
||||
if (capslock && (key >= 'a') && (key <='z'))
|
||||
keycode = key - 32;
|
||||
else
|
||||
@ -174,12 +174,12 @@ void KeybQueueKeypress (int key, BOOL bASCII)
|
||||
if ((key == VK_CANCEL) && (GetKeyState(VK_CONTROL) < 0))
|
||||
{
|
||||
// Ctrl+Reset
|
||||
if (apple2e)
|
||||
if (g_bApple2e)
|
||||
MemResetPaging();
|
||||
|
||||
DiskReset();
|
||||
KeybReset();
|
||||
if (apple2e)
|
||||
if (g_bApple2e)
|
||||
VideoResetState(); // Switch Alternate char set off
|
||||
MB_Reset();
|
||||
|
||||
@ -199,10 +199,10 @@ void KeybQueueKeypress (int key, BOOL bASCII)
|
||||
return;
|
||||
}
|
||||
|
||||
if (!((key >= VK_LEFT) && (key <= VK_DELETE) && asciicode[apple2e][key - VK_LEFT]))
|
||||
if (!((key >= VK_LEFT) && (key <= VK_DELETE) && asciicode[g_bApple2e][key - VK_LEFT]))
|
||||
return;
|
||||
|
||||
keycode = asciicode[apple2e][key - VK_LEFT]; // Convert to Apple arrow keycode
|
||||
keycode = asciicode[g_bApple2e][key - VK_LEFT]; // Convert to Apple arrow keycode
|
||||
lastvirtkey = key;
|
||||
}
|
||||
#ifdef KEY_OLD
|
||||
@ -375,7 +375,7 @@ BYTE __stdcall KeybReadFlag (WORD, BYTE, BYTE, BYTE, ULONG)
|
||||
//===========================================================================
|
||||
void KeybToggleCapsLock ()
|
||||
{
|
||||
if (apple2e)
|
||||
if (g_bApple2e)
|
||||
{
|
||||
capslock = (GetKeyState(VK_CAPITAL) & 1);
|
||||
FrameRefreshStatus(DRAW_LEDS);
|
||||
|
@ -854,14 +854,13 @@ LPBYTE MemGetMainPtr (WORD offset) {
|
||||
//===========================================================================
|
||||
void MemInitialize () {
|
||||
|
||||
// ALLOCATE MEMORY FOR THE APPLE MEMORY IMAGE AND ASSOCIATED DATA
|
||||
// STRUCTURES
|
||||
// ALLOCATE MEMORY FOR THE APPLE MEMORY IMAGE AND ASSOCIATED DATA STRUCTURES
|
||||
//
|
||||
// THE MEMIMAGE BUFFER CAN CONTAIN EITHER MULTIPLE MEMORY IMAGES OR
|
||||
// ONE MEMORY IMAGE WITH COMPILER DATA
|
||||
memaux = (LPBYTE)VirtualAlloc(NULL,0x10000,MEM_COMMIT,PAGE_READWRITE);
|
||||
memaux = (LPBYTE)VirtualAlloc(NULL,_6502_MEM_END+1,MEM_COMMIT,PAGE_READWRITE); // _6502_MEM_END // 0x10000
|
||||
memdirty = (LPBYTE)VirtualAlloc(NULL,0x100 ,MEM_COMMIT,PAGE_READWRITE);
|
||||
memmain = (LPBYTE)VirtualAlloc(NULL,0x10000,MEM_COMMIT,PAGE_READWRITE);
|
||||
memmain = (LPBYTE)VirtualAlloc(NULL,_6502_MEM_END+1,MEM_COMMIT,PAGE_READWRITE);
|
||||
memrom = (LPBYTE)VirtualAlloc(NULL,0x5000 ,MEM_COMMIT,PAGE_READWRITE);
|
||||
memimage = (LPBYTE)VirtualAlloc(NULL,
|
||||
MAX(0x30000,MAXIMAGES*0x10000),
|
||||
@ -895,16 +894,20 @@ void MemInitialize () {
|
||||
#endif
|
||||
|
||||
// READ THE APPLE FIRMWARE ROMS INTO THE ROM IMAGE
|
||||
const UINT ROM_SIZE = 0x5000; // HACK: Magic #
|
||||
const UINT ROM_SIZE = 0x5000; // HACK: Magic # -- $C000..$FFFF = 4K .. why 5K?
|
||||
|
||||
HRSRC hResInfo =
|
||||
g_bApple2e
|
||||
? FindResource(NULL, MAKEINTRESOURCE(IDR_APPLE2E_ROM), "ROM")
|
||||
: (g_bApple2plus
|
||||
? FindResource(NULL, MAKEINTRESOURCE(IDR_APPLE2PLUS_ROM), "ROM")
|
||||
: FindResource(NULL, MAKEINTRESOURCE(IDR_APPLE2ORIG_ROM), "ROM") );
|
||||
|
||||
HRSRC hResInfo = apple2e ? FindResource(NULL, MAKEINTRESOURCE(IDR_APPLE2E_ROM), "ROM")
|
||||
: (apple2plus ? FindResource(NULL, MAKEINTRESOURCE(IDR_APPLE2PLUS_ROM), "ROM")
|
||||
: FindResource(NULL, MAKEINTRESOURCE(IDR_APPLE2ORIG_ROM), "ROM"));
|
||||
if(hResInfo == NULL)
|
||||
{
|
||||
TCHAR sRomFileName[ 128 ];
|
||||
_tcscpy( sRomFileName, apple2e ? TEXT("APPLE2E.ROM")
|
||||
: (apple2plus ? TEXT("APPLE2PLUS.ROM")
|
||||
_tcscpy( sRomFileName, g_bApple2e ? TEXT("APPLE2E.ROM")
|
||||
: (g_bApple2plus ? TEXT("APPLE2PLUS.ROM")
|
||||
: TEXT("APPLE2ORIG.ROM")));
|
||||
|
||||
TCHAR sText[ 256 ];
|
||||
@ -1066,7 +1069,7 @@ BYTE __stdcall MemSetPaging (WORD programcounter, BYTE address, BYTE write, BYTE
|
||||
memmode |= MF_HIGHRAM;
|
||||
lastwriteram = writeram;
|
||||
}
|
||||
else if (apple2e)
|
||||
else if (g_bApple2e)
|
||||
{
|
||||
switch (address)
|
||||
{
|
||||
@ -1189,7 +1192,7 @@ BYTE __stdcall CxReadFunc(WORD, WORD nAddr, BYTE, BYTE, ULONG nCyclesLeft)
|
||||
|
||||
CpuCalcCycles(nCyclesLeft);
|
||||
|
||||
if(!apple2e || SW_SLOTCXROM)
|
||||
if(!g_bApple2e || SW_SLOTCXROM)
|
||||
{
|
||||
if((nPage == 0xC4) || (nPage == 0xC5))
|
||||
{
|
||||
@ -1218,7 +1221,7 @@ BYTE __stdcall CxWriteFunc(WORD, WORD nAddr, BYTE, BYTE nValue, ULONG nCyclesLef
|
||||
|
||||
CpuCalcCycles(nCyclesLeft);
|
||||
|
||||
if(!apple2e || SW_SLOTCXROM)
|
||||
if(!g_bApple2e || SW_SLOTCXROM)
|
||||
{
|
||||
if((nPage == 0xC4) || (nPage == 0xC5))
|
||||
{
|
||||
|
@ -207,14 +207,15 @@ static void ConfigDlg_OK(HWND window, BOOL afterclose)
|
||||
DWORD newvidtype = (DWORD)SendDlgItemMessage(window,IDC_VIDEOTYPE,CB_GETCURSEL,0,0);
|
||||
DWORD newserialport = (DWORD)SendDlgItemMessage(window,IDC_SERIALPORT,CB_GETCURSEL,0,0);
|
||||
|
||||
if (newcomptype != (apple2e ? 2 : (apple2plus ? 1 : 0)))
|
||||
if (newcomptype != (g_bApple2e ? 2 : (g_bApple2plus ? 1 : 0)))
|
||||
{
|
||||
if (MessageBox(window,
|
||||
TEXT("You have changed the emulated computer ")
|
||||
TEXT("type. This change will not take effect ")
|
||||
TEXT("until the next time you restart the ")
|
||||
TEXT("emulator.\n\n")
|
||||
TEXT("Would you like to restart the emulator now?"),
|
||||
TEXT(
|
||||
"You have changed the emulated computer "
|
||||
"type. This change will not take effect "
|
||||
"until the next time you restart the "
|
||||
"emulator.\n\n"
|
||||
"Would you like to restart the emulator now?"),
|
||||
TEXT("Configuration"),
|
||||
MB_ICONQUESTION | MB_YESNO | MB_SETFOREGROUND) == IDYES)
|
||||
afterclose = WM_USER_RESTART;
|
||||
@ -341,7 +342,7 @@ static BOOL CALLBACK ConfigDlgProc (HWND window,
|
||||
{
|
||||
g_nLastPage = PG_CONFIG;
|
||||
|
||||
FillComboBox(window,IDC_COMPUTER,computerchoices,apple2e ? 2 : (apple2plus ? 1 : 0));
|
||||
FillComboBox(window,IDC_COMPUTER,computerchoices,g_bApple2e ? 2 : (g_bApple2plus ? 1 : 0));
|
||||
FillComboBox(window,IDC_VIDEOTYPE,videochoices,videotype);
|
||||
FillComboBox(window,IDC_SERIALPORT,serialchoices,serialport);
|
||||
SendDlgItemMessage(window,IDC_SLIDER_CPU_SPEED,TBM_SETRANGE,1,MAKELONG(0,40));
|
||||
@ -669,7 +670,7 @@ static void SaveStateUpdate()
|
||||
RegSaveString(TEXT("Configuration"),REGVALUE_SAVESTATE_FILENAME,1,Snapshot_GetFilename());
|
||||
|
||||
if(g_szNewDirectory[0])
|
||||
RegSaveString(TEXT("Preferences"),TEXT("Starting Directory"),1,g_szNewDirectory);
|
||||
RegSaveString(TEXT("Preferences"),REGVALUE_PREF_START_DIR,1,g_szNewDirectory);
|
||||
}
|
||||
|
||||
static void SaveStateDlg_OK(HWND window, BOOL afterclose)
|
||||
@ -711,7 +712,7 @@ static int SaveStateSelectImage(HWND hWindow, TCHAR* pszTitle, bool bSave)
|
||||
|
||||
strcpy(szFilename, Snapshot_GetFilename());
|
||||
|
||||
RegLoadString(TEXT("Preferences"),TEXT("Starting Directory"),1,szDirectory,MAX_PATH);
|
||||
RegLoadString(TEXT("Preferences"),REGVALUE_PREF_START_DIR,1,szDirectory,MAX_PATH);
|
||||
|
||||
|
||||
//
|
||||
|
@ -116,7 +116,7 @@ void Snapshot_LoadState()
|
||||
// Reset all sub-systems
|
||||
MemReset();
|
||||
|
||||
if (apple2e)
|
||||
if (g_bApple2e)
|
||||
MemResetPaging();
|
||||
|
||||
DiskReset();
|
||||
|
@ -970,7 +970,7 @@ BOOL Update40ColCell (int x, int y, int xpixel, int ypixel, int offset)
|
||||
|
||||
CopySource(xpixel,ypixel,
|
||||
14,16,
|
||||
(apple2e?SRCOFFS_40COL:SRCOFFS_IIPLUS)+((ch & 0x0F) << 4),
|
||||
(g_bApple2e?SRCOFFS_40COL:SRCOFFS_IIPLUS)+((ch & 0x0F) << 4),
|
||||
(ch & 0xF0)+charoffs + (bInvert?0x40:0x00));
|
||||
|
||||
return 1;
|
||||
@ -1478,7 +1478,7 @@ void VideoBenchmark () {
|
||||
(unsigned)totaltextfps,
|
||||
(unsigned)(totalmhz10/10),
|
||||
(unsigned)(totalmhz10 % 10),
|
||||
(LPCTSTR)(apple2e ? TEXT("") : TEXT(" (6502)")),
|
||||
(LPCTSTR)(g_bApple2e ? TEXT("") : TEXT(" (6502)")),
|
||||
(unsigned)realisticfps);
|
||||
MessageBox(g_hFrameWindow,
|
||||
outstr,
|
||||
@ -1936,10 +1936,10 @@ BYTE __stdcall VideoSetMode (WORD, BYTE address, BYTE write, BYTE, ULONG) {
|
||||
switch (address) {
|
||||
case 0x00: vidmode &= ~VF_MASK2; break;
|
||||
case 0x01: vidmode |= VF_MASK2; break;
|
||||
case 0x0C: if (apple2e) vidmode &= ~VF_80COL; break;
|
||||
case 0x0D: if (apple2e) vidmode |= VF_80COL; break;
|
||||
case 0x0E: if (apple2e) charoffs = 0; break; // Alternate char set off
|
||||
case 0x0F: if (apple2e) charoffs = 256; break; // Alternate char set on
|
||||
case 0x0C: if (g_bApple2e) vidmode &= ~VF_80COL; break;
|
||||
case 0x0D: if (g_bApple2e) vidmode |= VF_80COL; break;
|
||||
case 0x0E: if (g_bApple2e) charoffs = 0; break; // Alternate char set off
|
||||
case 0x0F: if (g_bApple2e) charoffs = 256; break; // Alternate char set on
|
||||
case 0x50: vidmode &= ~VF_TEXT; break;
|
||||
case 0x51: vidmode |= VF_TEXT; break;
|
||||
case 0x52: vidmode &= ~VF_MIXED; break;
|
||||
@ -1948,8 +1948,8 @@ BYTE __stdcall VideoSetMode (WORD, BYTE address, BYTE write, BYTE, ULONG) {
|
||||
case 0x55: vidmode |= VF_PAGE2; break;
|
||||
case 0x56: vidmode &= ~VF_HIRES; break;
|
||||
case 0x57: vidmode |= VF_HIRES; break;
|
||||
case 0x5E: if (apple2e) vidmode |= VF_DHIRES; break;
|
||||
case 0x5F: if (apple2e) vidmode &= ~VF_DHIRES; break;
|
||||
case 0x5E: if (g_bApple2e) vidmode |= VF_DHIRES; break;
|
||||
case 0x5F: if (g_bApple2e) vidmode &= ~VF_DHIRES; break;
|
||||
}
|
||||
if (SW_MASK2)
|
||||
vidmode &= ~VF_PAGE2;
|
||||
@ -2134,7 +2134,7 @@ WORD VideoGetScannerAddress(bool* pbVblBar_OUT)
|
||||
{
|
||||
// N: text, so no higher address bits unless Apple ][, not Apple //e
|
||||
//
|
||||
if ((!apple2e) && // Apple ][?
|
||||
if ((!g_bApple2e) && // Apple ][?
|
||||
(kHPEClock <= nHClock) && // Y: HBL?
|
||||
(nHClock <= (kHClocks - 1)))
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user