From 05ce17aea8a666dd0365ee599ee6b7784f86c043 Mon Sep 17 00:00:00 2001 From: InvisibleUp Date: Mon, 10 Feb 2020 22:29:46 -0500 Subject: [PATCH] Remove any and all nagware functionality --- src/ACTVCODE.h | 373 ------------------------------------------------- src/CONTROLM.h | 106 +------------- src/INTLCHAR.h | 44 ------ src/OSGLUCCO.m | 6 - src/OSGLUGTK.c | 3 - src/OSGLUMAC.c | 6 - src/OSGLUNDS.c | 3 - src/OSGLUOSX.c | 6 - src/OSGLUSD2.c | 3 - src/OSGLUSDL.c | 3 - src/OSGLUWIN.c | 134 +----------------- src/OSGLUXWN.c | 6 - 12 files changed, 7 insertions(+), 686 deletions(-) delete mode 100644 src/ACTVCODE.h diff --git a/src/ACTVCODE.h b/src/ACTVCODE.h deleted file mode 100644 index 0867a25..0000000 --- a/src/ACTVCODE.h +++ /dev/null @@ -1,373 +0,0 @@ -/* - ACTVCODE.h - - Copyright (C) 2009 Paul C. Pratt - - You can redistribute this file and/or modify it under the terms - of version 2 of the GNU General Public License as published by - the Free Software Foundation. You should have received a copy - of the license along with this file; see the file COPYING. - - This file is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - license for more details. -*/ - -/* - ACTiVation CODE -*/ - -LOCALFUNC uimr KeyFun0(uimr x, uimr y, uimr m) -{ - uimr r = x + y; - - if ((r >= m) || (r < x)) { - r -= m; - } - - return r; -} - -LOCALFUNC uimr KeyFun1(uimr x, uimr y, uimr m) -{ - uimr r = 0; - uimr t = x; - uimr s = y; - - while (s > 0) { - if (0 != (s & 1)) { - r = KeyFun0(r, t, m); - } - t = KeyFun0(t, t, m); - s >>= 1; - } - - return r; -} - -LOCALFUNC uimr KeyFun2(uimr x, uimr y, uimr m) -{ - uimr r = 1; - uimr t = x; - uimr s = y; - - while (s > 0) { - if (0 != (s & 1)) { - r = KeyFun1(r, t, m); - } - t = KeyFun1(t, t, m); - s >>= 1; - } - - return r; -} - -LOCALFUNC blnr CheckActvCode(ui3p p, blnr *Trial) -{ - blnr IsOk = falseblnr; - uimr v0 = do_get_mem_long(p); - uimr v1 = do_get_mem_long(p + 4); - - if (v0 > KeyCon2) { - /* v0 too big */ - } else if (v1 > KeyCon4) { - /* v1 too big */ - } else { - uimr t0 = KeyFun0(v0, KeyCon0, KeyCon2); - uimr t1 = KeyFun2(KeyCon1, t0, KeyCon2); - uimr t2 = KeyFun2(v1, KeyCon3, KeyCon4); - uimr t3 = KeyFun0(t2, KeyCon4 - t1, KeyCon4); - uimr t4 = KeyFun0(t3, KeyCon4 - KeyCon5, KeyCon4); - if ((0 == (t4 >> 8)) && (t4 >= KeyCon6)) { - *Trial = falseblnr; - IsOk = trueblnr; - } else if (0 == t4) { - *Trial = trueblnr; - IsOk = trueblnr; - } - } - - return IsOk; -} - -/* user interface */ - -LOCALFUNC blnr Key2Digit(ui3r key, ui3r *r) -{ - ui3r v; - - switch (key) { - case MKC_0: - case MKC_KP0: - v = 0; - break; - case MKC_1: - case MKC_KP1: - v = 1; - break; - case MKC_2: - case MKC_KP2: - v = 2; - break; - case MKC_3: - case MKC_KP3: - v = 3; - break; - case MKC_4: - case MKC_KP4: - v = 4; - break; - case MKC_5: - case MKC_KP5: - v = 5; - break; - case MKC_6: - case MKC_KP6: - v = 6; - break; - case MKC_7: - case MKC_KP7: - v = 7; - break; - case MKC_8: - case MKC_KP8: - v = 8; - break; - case MKC_9: - case MKC_KP9: - v = 9; - break; - default: - return falseblnr; - break; - } - - *r = v; - return trueblnr; -} - -#define ActvCodeMaxLen 20 -LOCALVAR ui4r ActvCodeLen = 0; -LOCALVAR ui3b ActvCodeDigits[ActvCodeMaxLen]; - -#define ActvCodeFileLen 8 - -#if UseActvFile -FORWARDFUNC tMacErr ActvCodeFileSave(ui3p p); -FORWARDFUNC tMacErr ActvCodeFileLoad(ui3p p); -#endif - -LOCALVAR ui3b CurActvCode[ActvCodeFileLen]; - -LOCALPROC DoActvCodeModeKey(ui3r key) -{ - ui3r digit; - ui3r L; - int i; - blnr Trial; - - if (MKC_BackSpace == key) { - if (ActvCodeLen > 0) { - --ActvCodeLen; - NeedWholeScreenDraw = trueblnr; - } - } else if (Key2Digit(key, &digit)) { - if (ActvCodeLen < (ActvCodeMaxLen - 1)) { - ActvCodeDigits[ActvCodeLen] = digit; - ++ActvCodeLen; - NeedWholeScreenDraw = trueblnr; - L = ActvCodeDigits[0] + (1 + 9); - if (ActvCodeLen == L) { - uimr v0 = 0; - uimr v1 = 0; - - for (i = 1; i < (ActvCodeDigits[0] + 1); ++i) { - v0 = v0 * 10 + ActvCodeDigits[i]; - } - for (; i < ActvCodeLen; ++i) { - v1 = v1 * 10 + ActvCodeDigits[i]; - } - - do_put_mem_long(&CurActvCode[0], v0); - do_put_mem_long(&CurActvCode[4], v1); - - if (CheckActvCode(CurActvCode, &Trial)) { - SpecialModeClr(SpclModeActvCode); - NeedWholeScreenDraw = trueblnr; -#if UseActvFile - if (Trial) { - MacMsg( - "Using temporary code.", - "Thank you for trying Mini vMac!", - falseblnr); - } else { - if (mnvm_noErr != ActvCodeFileSave(CurActvCode)) - { - MacMsg("Oops", - "I could not save the activation code" - " to disk.", - falseblnr); - } else { - MacMsg("Activation succeeded.", - "Thank you!", falseblnr); - } - } -#else - MacMsg( - "Thank you for trying Mini vMac!", - "sample variation : ^v", - falseblnr); -#endif - } - } else if (ActvCodeLen > L) { - --ActvCodeLen; - } - } - } -} - -LOCALPROC DrawCellsActvCodeModeBody(void) -{ -#if UseActvFile - DrawCellsOneLineStr("Please enter your activation code:"); - DrawCellsBlankLine(); -#else - DrawCellsOneLineStr( - "To try this variation of ^p, please type these numbers:"); - DrawCellsBlankLine(); - DrawCellsOneLineStr("281 953 822 340"); - DrawCellsBlankLine(); -#endif - - if (0 == ActvCodeLen) { - DrawCellsOneLineStr("?"); - } else { - int i; - ui3r L = ActvCodeDigits[0] + (1 + 9); - - DrawCellsBeginLine(); - for (i = 0; i < L; ++i) { - if (0 == ((L - i) % 3)) { - if (0 != i) { - DrawCellAdvance(kCellSpace); - } - } - if (i < ActvCodeLen) { - DrawCellAdvance(kCellDigit0 + ActvCodeDigits[i]); - } else if (i == ActvCodeLen) { - DrawCellAdvance(kCellQuestion); - } else { - DrawCellAdvance(kCellHyphen); - } - } - DrawCellsEndLine(); - if (L == ActvCodeLen) { - DrawCellsBlankLine(); - DrawCellsOneLineStr( - "Sorry, this is not a valid activation code."); - } - } - -#if UseActvFile - DrawCellsBlankLine(); - DrawCellsOneLineStr( - "If you haven;}t obtained an activation code yet," - " here is a temporary one:"); - DrawCellsBlankLine(); - DrawCellsOneLineStr("281 953 822 340"); -#else - DrawCellsBlankLine(); - DrawCellsOneLineStr(kStrForMoreInfo); - DrawCellsOneLineStr("http://www.gryphel.com/c/var/"); -#endif -} - -LOCALPROC DrawActvCodeMode(void) -{ - DrawSpclMode0( -#if UseActvFile - "Activation Code", -#else - "sample variation : ^v", -#endif - DrawCellsActvCodeModeBody); -} - -#if UseActvFile -LOCALPROC ClStrAppendHexLong(int *L0, ui3b *r, ui5r v) -{ - ClStrAppendHexWord(L0, r, (v >> 16) & 0xFFFF); - ClStrAppendHexWord(L0, r, v & 0xFFFF); -} -#endif - -LOCALPROC CopyRegistrationStr(void) -{ - ui3b ps[ClStrMaxLength]; - int i; - int L; - tPbuf j; -#if UseActvFile - int L0; - ui5r sum; - - ClStrFromSubstCStr(&L0, ps, "^v "); - - for (i = 0; i < L0; ++i) { - ps[i] = Cell2MacAsciiMap[ps[i]]; - } - L = L0; - - sum = 0; - for (i = 0; i < L; ++i) { - sum += ps[i]; - sum = (sum << 5) | ((sum >> (32 - 5)) & 0x1F); - sum += (sum << 8); - } - - sum &= 0x1FFFFFFF; - - sum = KeyFun0(sum, do_get_mem_long(&CurActvCode[0]), KeyCon4); - - ClStrAppendHexLong(&L, ps, sum); - - sum = KeyFun0(sum, do_get_mem_long(&CurActvCode[4]), KeyCon4); - sum = KeyFun2(sum, KeyCon3, KeyCon4); - - ClStrAppendHexLong(&L, ps, sum); - - for (i = L0; i < L; ++i) { - ps[i] = Cell2MacAsciiMap[ps[i]]; - } -#else - ClStrFromSubstCStr(&L, ps, "^v"); - - for (i = 0; i < L; ++i) { - ps[i] = Cell2MacAsciiMap[ps[i]]; - } -#endif - - if (mnvm_noErr == PbufNew(L, &j)) { - PbufTransfer(ps, j, 0, L, trueblnr); - HTCEexport(j); - } -} - -LOCALFUNC blnr ActvCodeInit(void) -{ -#if UseActvFile - blnr Trial; - - if ((mnvm_noErr != ActvCodeFileLoad(CurActvCode)) - || (! CheckActvCode(CurActvCode, &Trial)) - || Trial - ) -#endif - { - SpecialModeSet(SpclModeActvCode); - NeedWholeScreenDraw = trueblnr; - } - - return trueblnr; -} diff --git a/src/CONTROLM.h b/src/CONTROLM.h index ebfb998..9b50f36 100644 --- a/src/CONTROLM.h +++ b/src/CONTROLM.h @@ -25,21 +25,14 @@ #endif enum { -#if EnableDemoMsg - SpclModeDemo, -#endif #if EnableAltKeysMode SpclModeAltKeyText, -#endif -#if UseActvCode - SpclModeActvCode, #endif SpclModeNoRom, SpclModeMessage, #if UseControlKeys SpclModeControl, #endif - kNumSpclModes }; @@ -325,7 +318,7 @@ LOCALPROC DrawSpclMode0(char *Title, SpclModeBody Body) #define DisconnectKeyCodes1 DisconnectKeyCodes #endif -#if WantAbnormalReports || UseActvFile +#if WantAbnormalReports LOCALPROC ClStrAppendHexNib(int *L0, ui3b *r, ui3r v) { if (v < 10) { @@ -336,7 +329,7 @@ LOCALPROC ClStrAppendHexNib(int *L0, ui3b *r, ui3r v) } #endif -#if WantAbnormalReports || UseActvFile +#if WantAbnormalReports LOCALPROC ClStrAppendHexByte(int *L0, ui3b *r, ui3r v) { ClStrAppendHexNib(L0, r, (v >> 4) & 0x0F); @@ -344,7 +337,7 @@ LOCALPROC ClStrAppendHexByte(int *L0, ui3b *r, ui3r v) } #endif -#if WantAbnormalReports || UseActvFile +#if WantAbnormalReports LOCALPROC ClStrAppendHexWord(int *L0, ui3b *r, ui4r v) { ClStrAppendHexByte(L0, r, (v >> 8) & 0xFF); @@ -514,10 +507,6 @@ enum { #if IncludePbufs kCntrlMsgOptionsStrCopied, #endif -#if 0 && (UseActvCode || EnableDemoMsg) - kCntrlMsgRegStrCopied, -#endif - kNumCntrlMsgs }; @@ -617,18 +606,6 @@ LOCALPROC CopyOptionsStr(void) } #endif -#if 0 -#if UseActvCode -FORWARDPROC CopyRegistrationStr(void); -#elif EnableDemoMsg -LOCALPROC CopyRegistrationStr(void) -{ - HTCEexportSubstCStr("^v"); -} -#endif -#endif - - LOCALPROC DoControlModeKey(ui3r key) { switch (CurControlMode) { @@ -700,12 +677,6 @@ LOCALPROC DoControlModeKey(ui3r key) ControlMessage = kCntrlMsgOptionsStrCopied; break; #endif -#if 0 && (UseActvCode || EnableDemoMsg) - case MKC_P: - CopyRegistrationStr(); - ControlMessage = kCntrlMsgRegStrCopied; - break; -#endif #if NeedRequestIthDisk case MKC_1: RequestIthDisk = 1; @@ -976,17 +947,6 @@ LOCALPROC DrawCellsControlModeBody(void) DrawCellsOneLineStr(kStrHaveCopiedOptions); break; #endif -#if 0 -#if UseActvCode - case kCntrlMsgRegStrCopied: - DrawCellsOneLineStr("Registration String copied."); - break; -#elif EnableDemoMsg - case kCntrlMsgRegStrCopied: - DrawCellsOneLineStr("Variation name copied."); - break; -#endif -#endif #if WantEnblCtrlRst case kCntrlMsgConfirmResetStart: DrawCellsOneLineStr(kStrConfirmReset); @@ -1043,39 +1003,6 @@ LOCALPROC DrawControlMode(void) #endif /* UseControlKeys */ -#if EnableDemoMsg - -LOCALPROC DrawDemoMode(void) -{ - CurCellv0 = ControlBoxv0 + ((9 * CurMacDateInSeconds) & 0x0F); - CurCellh0 = ControlBoxh0 + ((15 * CurMacDateInSeconds) & 0x1F); - - DrawCellAdvance(kCellDemo0); - DrawCellAdvance(kCellDemo6); - DrawCellAdvance(kCellDemo6); - DrawCellAdvance(kCellDemo7); - DrawCellAdvance(kCellDemo1); - DrawCellAdvance(kCellDemo2); - DrawCellAdvance(kCellDemo3); - DrawCellAdvance(kCellDemo4); - DrawCellAdvance(kCellDemo7); - DrawCellAdvance(kCellDemo6); - DrawCellAdvance(kCellDemo6); - DrawCellAdvance(kCellDemo5); -} - -LOCALPROC DemoModeSecondNotify(void) -{ - NeedWholeScreenDraw = trueblnr; - SpecialModeSet(SpclModeDemo); -} - -#endif /* EnableDemoMsg */ - -#if UseActvCode -#include "ACTVCODE.h" -#endif - LOCALPROC DrawSpclMode(void) { #if UseControlKeys @@ -1089,20 +1016,10 @@ LOCALPROC DrawSpclMode(void) if (SpecialModeTst(SpclModeNoRom)) { DrawNoRomMode(); } else -#if UseActvCode - if (SpecialModeTst(SpclModeActvCode)) { - DrawActvCodeMode(); - } else -#endif #if EnableAltKeysMode if (SpecialModeTst(SpclModeAltKeyText)) { DrawAltKeyMode(); } else -#endif -#if EnableDemoMsg - if (SpecialModeTst(SpclModeDemo)) { - DrawDemoMode(); - } else #endif { /* should not get here */ @@ -1253,16 +1170,10 @@ LOCALPROC Keyboard_UpdateKeyMap2(ui3r key, blnr down) } else #endif if ((0 == SpecialModes) -#if EnableAltKeysMode || EnableDemoMsg - || (0 == (SpecialModes & ~ ( - 0 #if EnableAltKeysMode - | (1 << SpclModeAltKeyText) -#endif -#if EnableDemoMsg - | (1 << SpclModeDemo) -#endif - ))) + || (0 == (SpecialModes & ~ ( + 0 | (1 << SpclModeAltKeyText) + ))) #endif || (MKC_CapsLock == key) ) @@ -1279,11 +1190,6 @@ LOCALPROC Keyboard_UpdateKeyMap2(ui3r key, blnr down) if (SpecialModeTst(SpclModeMessage)) { DoMessageModeKey(key); } else -#if UseActvCode - if (SpecialModeTst(SpclModeActvCode)) { - DoActvCodeModeKey(key); - } else -#endif { } } /* else if not down ignore */ diff --git a/src/INTLCHAR.h b/src/INTLCHAR.h index c22519b..fae9ae9 100644 --- a/src/INTLCHAR.h +++ b/src/INTLCHAR.h @@ -640,33 +640,6 @@ LOCALVAR const ui3b CellData[] = { 0xFF, 0x00, 0x00, 0x00, 0x00, 0xC3, 0x00, 0x00, 0x00, 0x00, 0xC3, 0x00, 0x00, 0x00, 0x00, 0xFF, #endif -#if EnableDemoMsg - /* kCellDemo0 */ - 0xFF, 0x80, 0x80, 0x80, 0x80, 0x83, 0x80, 0x80, - 0x80, 0x80, 0x83, 0x80, 0x80, 0x80, 0x80, 0xFF, - /* kCellDemo1 */ - 0xFF, 0x00, 0x00, 0x7C, 0x42, 0x42, 0x42, 0x42, - 0x42, 0x42, 0x42, 0x7C, 0x00, 0x00, 0x00, 0xFF, - /* kCellDemo2 */ - 0xFF, 0x00, 0x00, 0x00, 0x00, 0x00, 0x3C, 0x42, - 0x7E, 0x40, 0x42, 0x3C, 0x00, 0x00, 0x00, 0xFF, - /* kCellDemo3 */ - 0xFF, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFC, 0x92, - 0x92, 0x92, 0x92, 0x92, 0x00, 0x00, 0x00, 0xFF, - /* kCellDemo4 */ - 0xFF, 0x00, 0x00, 0x00, 0x00, 0x00, 0x3C, 0x42, - 0x42, 0x42, 0x42, 0x3C, 0x00, 0x00, 0x00, 0xFF, - /* kCellDemo5 */ - 0xFF, 0x01, 0x01, 0x01, 0x01, 0xC1, 0x01, 0x01, - 0x01, 0x01, 0xC1, 0x01, 0x01, 0x01, 0x01, 0xFF, - /* kCellDemo6 */ - 0xFF, 0x00, 0x00, 0x00, 0x00, 0xC3, 0x00, 0x00, - 0x00, 0x00, 0xC3, 0x00, 0x00, 0x00, 0x00, 0xFF, - /* kCellDemo7 */ - 0xFF, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFF, -#endif - 0x00 /* just so last above line can end in ',' */ }; @@ -883,26 +856,9 @@ enum { kInsertText03, kInsertText04, #endif -#if EnableDemoMsg - kCellDemo0, - kCellDemo1, - kCellDemo2, - kCellDemo3, - kCellDemo4, - kCellDemo5, - kCellDemo6, - kCellDemo7, -#endif - kNumCells }; -#if UseActvCode && 0 -#define UseActvFile 1 -#else -#define UseActvFile 0 -#endif - #ifndef NeedCell2MacAsciiMap #if 1 /* UseActvCode || EnableDemoMsg */ #define NeedCell2MacAsciiMap 1 diff --git a/src/OSGLUCCO.m b/src/OSGLUCCO.m index 4f592f6..6c1590c 100644 --- a/src/OSGLUCCO.m +++ b/src/OSGLUCCO.m @@ -4577,9 +4577,6 @@ label_retry: if (CheckDateTime()) { #if MySoundEnabled MySound_SecondNotify(); -#endif -#if EnableDemoMsg - DemoModeSecondNotify(); #endif } @@ -4908,9 +4905,6 @@ LOCALFUNC blnr InitOSGLU(void) for initial files. So must load ROM, disk1.dsk, etc first. */ -#if UseActvCode - if (ActvCodeInit()) -#endif #if EmLocalTalk if (InitLocalTalk()) #endif diff --git a/src/OSGLUGTK.c b/src/OSGLUGTK.c index d599956..56bc1ad 100644 --- a/src/OSGLUGTK.c +++ b/src/OSGLUGTK.c @@ -1301,9 +1301,6 @@ label_retry: } if (CheckDateTime()) { -#if EnableDemoMsg - DemoModeSecondNotify(); -#endif } if ((! gBackgroundFlag || ADialogIsUp) diff --git a/src/OSGLUMAC.c b/src/OSGLUMAC.c index 4255c79..094ba6c 100644 --- a/src/OSGLUMAC.c +++ b/src/OSGLUMAC.c @@ -5493,9 +5493,6 @@ label_retry: if (CheckDateTime()) { #if MySoundEnabled MySound_SecondNotify(); -#endif -#if EnableDemoMsg - DemoModeSecondNotify(); #endif } @@ -5692,9 +5689,6 @@ LOCALFUNC blnr InitOSGLU(void) if (ReCreateMainWindow()) if (LoadMacRom()) if (LoadInitialImages()) -#if UseActvCode - if (ActvCodeInit()) -#endif if (InitLocationDat()) if (WaitForRom()) { diff --git a/src/OSGLUNDS.c b/src/OSGLUNDS.c index 8d9cd8e..ad13d69 100644 --- a/src/OSGLUNDS.c +++ b/src/OSGLUNDS.c @@ -1049,9 +1049,6 @@ label_retry: if (CheckDateTime()) { #if MySoundEnabled MySound_SecondNotify(); -#endif -#if EnableDemoMsg - DemoModeSecondNotify(); #endif } diff --git a/src/OSGLUOSX.c b/src/OSGLUOSX.c index 22d1c4d..8cf878b 100644 --- a/src/OSGLUOSX.c +++ b/src/OSGLUOSX.c @@ -5281,9 +5281,6 @@ label_retry: if (CheckDateTime()) { #if MySoundEnabled MySound_SecondNotify(); -#endif -#if EnableDemoMsg - DemoModeSecondNotify(); #endif } @@ -5367,9 +5364,6 @@ LOCALFUNC blnr InitOSGLU(void) if (CreateMainWindow()) if (LoadMacRom()) if (LoadInitialImages()) -#if UseActvCode - if (ActvCodeInit()) -#endif #if EmLocalTalk if (InitLocalTalk()) #endif diff --git a/src/OSGLUSD2.c b/src/OSGLUSD2.c index 7ba27ad..c6b518e 100644 --- a/src/OSGLUSD2.c +++ b/src/OSGLUSD2.c @@ -4031,9 +4031,6 @@ label_retry: if (CheckDateTime()) { #if MySoundEnabled MySound_SecondNotify(); -#endif -#if EnableDemoMsg - DemoModeSecondNotify(); #endif } diff --git a/src/OSGLUSDL.c b/src/OSGLUSDL.c index 10a68d8..a38f085 100644 --- a/src/OSGLUSDL.c +++ b/src/OSGLUSDL.c @@ -2166,9 +2166,6 @@ label_retry: if (CheckDateTime()) { #if MySoundEnabled MySound_SecondNotify(); -#endif -#if EnableDemoMsg - DemoModeSecondNotify(); #endif } diff --git a/src/OSGLUWIN.c b/src/OSGLUWIN.c index 47bf9df..c30b7f9 100644 --- a/src/OSGLUWIN.c +++ b/src/OSGLUWIN.c @@ -4659,7 +4659,7 @@ LOCALFUNC blnr ResolveNamedChildFile(LPTSTR pathName, char *Child) && ! directory; } -#if UseActvFile || (IncludeSonyNew && ! SaveDialogEnable) +#if (IncludeSonyNew && ! SaveDialogEnable) LOCALFUNC blnr MakeNamedChildDir(LPTSTR pathName, char *Child) { blnr directory; @@ -4826,132 +4826,6 @@ LOCALFUNC blnr LoadInitialImages(void) return trueblnr; } -#if UseActvFile - -#define ActvCodeFileName "act_1" - -LOCALFUNC tMacErr ActvCodeFileLoad(ui3p p) -{ - TCHAR pathName[_MAX_PATH]; - DWORD BytesRead; - HANDLE refnum = INVALID_HANDLE_VALUE; - blnr IsOk = falseblnr; - - if (MyGetAppDataPath(pathName, FALSE)) - if (ResolveNamedChildDir(pathName, "Gryphel")) - if (ResolveNamedChildDir(pathName, "mnvm_act")) - if (ResolveNamedChildFile(pathName, ActvCodeFileName)) - { - refnum = CreateFile( - pathName, /* pointer to name of the file */ - GENERIC_READ, /* access (read-write) mode */ - FILE_SHARE_READ, /* share mode */ - NULL, /* pointer to security descriptor */ - OPEN_EXISTING, /* how to create */ - FILE_ATTRIBUTE_NORMAL, /* file attributes */ - NULL /* handle to file with attributes to copy */ - ); - if (INVALID_HANDLE_VALUE == refnum) { - /* report error */ - } else { - if (SetFilePointer( - refnum, /* handle of file */ - 0, /* number of bytes to move file pointer */ - nullpr, - /* address of high-order word of distance to move */ - FILE_BEGIN /* how to move */ - ) != 0) - { - /* report error */ - } else if (! ReadFile(refnum, /* handle of file to read */ - (LPVOID)p, /* address of buffer that receives data */ - (DWORD)ActvCodeFileLen, /* number of bytes to read */ - &BytesRead, /* address of number of bytes read */ - nullpr) /* address of structure for data */ - || ((ui5b)BytesRead != ActvCodeFileLen)) - { - /* report error */ - } else { - IsOk = trueblnr; - } - (void) CloseHandle(refnum); - } - } - - return IsOk ? mnvm_noErr : mnvm_miscErr; -} - -LOCALFUNC blnr NewNamedChildFile(LPTSTR pathName, char *Child) -{ - blnr directory; - blnr IsOk = falseblnr; - tMacErr err = ResolveNamedChild(pathName, Child, &directory); - - if (mnvm_noErr == err) { - IsOk = ! directory; - } else if (mnvm_fnfErr == err) { - IsOk = trueblnr; - } - - return IsOk; -} - -LOCALFUNC tMacErr ActvCodeFileSave(ui3p p) -{ - TCHAR pathName[_MAX_PATH]; - DWORD BytesWritten; - HANDLE refnum = INVALID_HANDLE_VALUE; - blnr IsOk = falseblnr; - - if (MyGetAppDataPath(pathName, TRUE)) - if (MakeNamedChildDir(pathName, "Gryphel")) - if (MakeNamedChildDir(pathName, "mnvm_act")) - if (NewNamedChildFile(pathName, ActvCodeFileName)) - { - refnum = CreateFile( - pathName, /* pointer to name of the file */ - GENERIC_READ + GENERIC_WRITE, /* access (read-write) mode */ - 0, /* share mode */ - NULL, /* pointer to security descriptor */ - CREATE_ALWAYS, /* how to create */ - FILE_ATTRIBUTE_NORMAL, /* file attributes */ - NULL /* handle to file with attributes to copy */ - ); - if (INVALID_HANDLE_VALUE == refnum) { - /* report error */ - } else { - if (SetFilePointer( - refnum, /* handle of file */ - 0, /* number of bytes to move file pointer */ - nullpr, - /* address of high-order word of distance to move */ - FILE_BEGIN /* how to move */ - ) != 0) - { - /* report error */ - } else if (! WriteFile(refnum, /* handle of file to read */ - (LPVOID)p, /* address of buffer that receives data */ - (DWORD)ActvCodeFileLen, /* number of bytes to read */ - &BytesWritten, /* address of number of bytes read */ - nullpr) /* address of structure for data */ - || ((ui5b)BytesWritten != ActvCodeFileLen)) - { - /* report error */ - } else { - IsOk = trueblnr; - } - (void) CloseHandle(refnum); - if (! IsOk) { - (void) DeleteFile(pathName); - } - } - } - - return IsOk ? mnvm_noErr : mnvm_miscErr; -} - -#endif /* UseActvFile */ - #if IncludeSonyNew LOCALFUNC blnr WriteZero(HANDLE refnum, ui5b L) { @@ -5906,9 +5780,6 @@ label_retry: if (CheckDateTime()) { #if MySoundEnabled MySound_SecondNotify(); -#endif -#if EnableDemoMsg - DemoModeSecondNotify(); #endif } @@ -6126,9 +5997,6 @@ LOCALFUNC blnr InitOSGLU(void) if (RegisterInRegistry()) #endif if (LoadMacRom()) -#if UseActvCode - if (ActvCodeInit()) -#endif #if UseWinCE if (Init_ChangeOrientation()) #endif diff --git a/src/OSGLUXWN.c b/src/OSGLUXWN.c index 702562f..3e34fa6 100644 --- a/src/OSGLUXWN.c +++ b/src/OSGLUXWN.c @@ -4466,9 +4466,6 @@ label_retry: if (CheckDateTime()) { #if MySoundEnabled MySound_SecondNotify(); -#endif -#if EnableDemoMsg - DemoModeSecondNotify(); #endif } @@ -4752,9 +4749,6 @@ LOCALFUNC blnr InitOSGLU(void) if (ScanCommandLine()) if (LoadMacRom()) if (LoadInitialImages()) -#if UseActvCode - if (ActvCodeInit()) -#endif if (InitLocationDat()) #if MySoundEnabled if (MySound_Init())