Skip to content

Commit

Permalink
Import Mini vMac 180819
Browse files Browse the repository at this point in the history
Today's Development source snapshot adds a Serbian translation
contributed by SerbXenomorph. This translation uses the Latin alphabet.
SerbXenomorph contributed the translation in the Cyrillic alphabet,
which was converted to the Latin alphabet with multiple online
conversion services, which all gave the same result. It would take much
more work for Mini vMac to support the Cyrillic alphabet, in its private
cross platform font. Maybe someday. (According to Wikipedia, "Serbian is
practically the only European standard language whose speakers are fully
functionally digraphic, using both Cyrillic and Latin alphabets.")

Today's snapshot also adds a new compile time option, "-sbx 1", to
enable Sandboxing in the Cocoa version for OS X. This is an Apple
security mechanism, so that any bugs, or even maliciousness, in Mini
vMac can only do limited harm. This option might be the default in a
future version of Mini vMac. However, it does remove some capabilities.
The single requested "entitlement" allows Mini vMac to read and write
files that the user has selected, with the Open File dialog, or by
dragging into the Mini vMac window or icon.

But Mini vMac's ability to automatically find files by name in special
locations is severely restricted. It is prevented from finding
"vMac.ROM", "disk1.dsk", "disk2.dsk", etc. in the folder containing the
application. It can find such files in a "mnvm_dat" folder created
inside the application, but only read only. It does not have access to
"~/Library/Preferences" to find "vMac.ROM" (but it does get access to
the corresponding folder inside its container folder, which is obscure).
It does have read only acces to "/Library/Application Support/".
Furthermore, if these named files are links that won't work unless the
file linked to is in one of the few places that a Sandboxed application
has access to.

The Cocoa version for OS X now looks for the ROM image in one additional
place, "/Library/Application Support/Gryphel/mnvm_rom/", which can be
read by a Sandboxed application.
  • Loading branch information
ryandesign committed Aug 9, 2019
1 parent 118ce01 commit 5329b84
Show file tree
Hide file tree
Showing 12 changed files with 321 additions and 1 deletion.
7 changes: 7 additions & 0 deletions setup/GNBLDOPT.i
Original file line number Diff line number Diff line change
Expand Up @@ -590,6 +590,7 @@ enum {
gbk_lang_ptb,
gbk_lang_cat,
gbk_lang_cze,
gbk_lang_srl,
kNumLangLevels
};

Expand Down Expand Up @@ -638,6 +639,9 @@ LOCALFUNC char * GetLangName(int i)
case gbk_lang_cze:
s = "cze";
break;
case gbk_lang_srl:
s = "srl";
break;
default:
s = "(unknown Language Level)";
break;
Expand Down Expand Up @@ -689,6 +693,9 @@ LOCALFUNC char * GetLProjName(int i)
case gbk_lang_cze:
s = "cs";
break;
case gbk_lang_srl:
s = "sr";
break;
default:
s = "(unknown Language Level)";
break;
Expand Down
47 changes: 47 additions & 0 deletions setup/SPBLDOPT.i
Original file line number Diff line number Diff line change
Expand Up @@ -3212,6 +3212,49 @@ LOCALPROC WrtOptGraphicsSwitching(void)
dfo_GraphicsSwitching());
}


/* option: Sandbox */

LOCALVAR blnr WantSandbox;
LOCALVAR ui3r olv_Sandbox;

LOCALPROC ResetSandbox(void)
{
WantSandbox = nanblnr;
olv_Sandbox = 0;
}

LOCALFUNC tMyErr TryAsSandboxNot(void)
{
return BooleanTryAsOptionNot("-sbx",
&WantSandbox, &olv_Sandbox);
}

#define dfo_Sandbox() falseblnr

LOCALFUNC tMyErr ChooseSandbox(void)
{
tMyErr err;

err = kMyErr_noErr;
if (nanblnr == WantSandbox) {
WantSandbox = dfo_Sandbox();
} else {
if (WantSandbox && (gbk_apifam_cco != gbo_apifam)) {
err = ReportParseFailure(
"-sbx is so far only implemented for cocoa on OS X");
}
}

return err;
}

LOCALPROC WrtOptSandbox(void)
{
WrtOptBooleanOption("-sbx", WantSandbox,
dfo_Sandbox());
}

/* ------ */

LOCALVAR blnr NeedScrnHack;
Expand Down Expand Up @@ -3454,6 +3497,7 @@ LOCALPROC SPResetCommandLineParameters(void)
ResetDbgLogHAVE();
ResetScreenVSync();
ResetGraphicsSwitching();
ResetSandbox();
}

LOCALFUNC tMyErr TryAsSPOptionNot(void)
Expand Down Expand Up @@ -3520,6 +3564,7 @@ LOCALFUNC tMyErr TryAsSPOptionNot(void)
if (kMyErrNoMatch == (err = TryAsDbgLogHAVENot()))
if (kMyErrNoMatch == (err = TryAsScreenVSyncNot()))
if (kMyErrNoMatch == (err = TryAsGraphicsSwitchingNot()))
if (kMyErrNoMatch == (err = TryAsSandboxNot()))
{
}

Expand Down Expand Up @@ -3592,6 +3637,7 @@ LOCALFUNC tMyErr AutoChooseSPSettings(void)
if (kMyErr_noErr == (err = ChooseDbgLogHAVE()))
if (kMyErr_noErr == (err = ChooseScreenVSync()))
if (kMyErr_noErr == (err = ChooseGraphicsSwitching()))
if (kMyErr_noErr == (err = ChooseSandbox()))

if (kMyErr_noErr == (err = ChooseScreenOpts())) /* derived */
if (kMyErr_noErr == (err = ChooseVidMemSize())) /* derived */
Expand Down Expand Up @@ -3666,4 +3712,5 @@ LOCALPROC WrtOptSPSettings(void)
WrtOptDbgLogHAVE();
WrtOptScreenVSync();
WrtOptGraphicsSwitching();
WrtOptSandbox();
}
2 changes: 1 addition & 1 deletion setup/SPCNFGAP.i
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ LOCALPROC WriteAppSpecificCNFGRAPIoptions(void)
break;
case gbk_mdl_II:
WriteDestFileLn("#define kRomCheckSum1 0x9779D2C4");
WriteDestFileLn("#define kRomCheckSum1 0x97221136");
WriteDestFileLn("#define kRomCheckSum2 0x97221136");
break;
case gbk_mdl_IIx:
WriteDestFileLn("#define kRomCheckSum1 0x97221136");
Expand Down
5 changes: 5 additions & 0 deletions setup/SPFILDEF.i
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,9 @@ static void DoMYOSGLUEdepends(tDoOneDepends p)
case gbk_lang_cze:
s = "STRCNCZE.h";
break;
case gbk_lang_srl:
s = "STRCNSRL.h";
break;
}

if (nullpr != s) {
Expand Down Expand Up @@ -149,6 +152,8 @@ static void DoAllSrcFiles(tDoOneCFile p)
CSrcFlagsUseHdrIf(gbk_lang_cat == gbo_lang), nullpr);
p("STRCNCZE", kDepDirCSrc,
CSrcFlagsUseHdrIf(gbk_lang_cze == gbo_lang), nullpr);
p("STRCNSRL", kDepDirCSrc,
CSrcFlagsUseHdrIf(gbk_lang_srl == gbo_lang), nullpr);

p("STRCONST", kDepDirCnfg, kCSrcFlgmNoSource, nullpr);
p("INTLCHAR", kDepDirCSrc, kCSrcFlgmNoSource, nullpr);
Expand Down
3 changes: 3 additions & 0 deletions setup/SPOTHRCF.i
Original file line number Diff line number Diff line change
Expand Up @@ -526,6 +526,9 @@ LOCALPROC WriteAppSTRCONSTcontents(void)
case gbk_lang_cze:
s = "CZE";
break;
case gbk_lang_srl:
s = "SRL";
break;
default:
s = "???";
break;
Expand Down
4 changes: 4 additions & 0 deletions setup/WRBGCFLS.i
Original file line number Diff line number Diff line change
Expand Up @@ -482,6 +482,10 @@ LOCALPROC WriteBashGccSpecificFiles(void)
WritePListData();
}

if (WantSandbox) {
WriteEntitlementsData();
}

WriteADstFile1("my_project_d",
"Makefile", "", "Make file",
WriteBashGccMakeFile);
Expand Down
26 changes: 26 additions & 0 deletions setup/WRMPLIST.i
Original file line number Diff line number Diff line change
Expand Up @@ -286,3 +286,29 @@ LOCALPROC WritePListData(void)
WriteInfoPListData);
}
}

LOCALPROC WriteEntitlementsData(void)
{
WriteOpenDestFile("my_config_d",
vStrAppAbbrev, ".entitlements", "entitlements");

WriteDestFileLn("<?xml version=\"1.0\" encoding=\"UTF-8\"?>");
WriteDestFileLn(
"<!DOCTYPE plist PUBLIC"
" \"-//Apple//DTD PLIST 1.0//EN\""
" \"http://www.apple.com/DTDs/PropertyList-1.0.dtd\">");
WriteDestFileLn("<plist version=\"1.0\">");
WriteDestFileLn("<dict>");
++DestFileIndent;
WriteDestFileLn("<key>com.apple.security.app-sandbox</key>");
WriteDestFileLn("<true/>");
WriteDestFileLn("<key>"
"com.apple.security.files.user-selected.read-write"
"</key>");
WriteDestFileLn("<true/>");
--DestFileIndent;
WriteDestFileLn("</dict>");
WriteDestFileLn("</plist>");

WriteCloseDestFile();
}
4 changes: 4 additions & 0 deletions setup/WRMVCFLS.i
Original file line number Diff line number Diff line change
Expand Up @@ -571,6 +571,10 @@ LOCALPROC WriteMVCSpecificFiles(void)
WritePListData();
}

if (WantSandbox) {
WriteEntitlementsData();
}

WriteADstFile1("my_project_d",
"Makefile", "", "Make file",
WriteMVCMakeFile);
Expand Down
4 changes: 4 additions & 0 deletions setup/WRXCDFLS.i
Original file line number Diff line number Diff line change
Expand Up @@ -2075,4 +2075,8 @@ LOCALPROC WriteXCDSpecificFiles(void)
"dummy", ".txt", "Dummy",
WriteOutDummyLangContents);
}

if (WantSandbox) {
WriteEntitlementsData();
}
}
18 changes: 18 additions & 0 deletions src/INTLCHAR.h
Original file line number Diff line number Diff line change
Expand Up @@ -552,6 +552,12 @@ LOCALVAR const ui3b CellData[] = {
/* kCellLoURing 077 ? 0x016F 'u' ';ru' #367 (uring) */
0x00, 0x00, 0x18, 0x24, 0x24, 0x18, 0x42, 0x42,
0x42, 0x42, 0x46, 0x3A, 0x00, 0x00, 0x00, 0x00,
/* kCellUpDStroke 077 ? 0x0110 'D' ';dD' #272 (Dstrok) */
0x00, 0x00, 0x00, 0x7C, 0x42, 0x42, 0x42, 0xF2,
0x42, 0x42, 0x42, 0x7C, 0x00, 0x00, 0x00, 0x00,
/* kCellLoDStroke 077 ? 0x0111 'd' ';dd' #273 (dstrok) */
0x00, 0x00, 0x00, 0x02, 0x0F, 0x02, 0x3E, 0x42,
0x42, 0x42, 0x42, 0x3E, 0x00, 0x00, 0x00, 0x00,
#endif

/* kCellUpperLeft */
Expand Down Expand Up @@ -845,6 +851,8 @@ enum {
kCellLoYAcute,
kCellLoUDblac,
kCellLoURing,
kCellUpDStroke,
kCellLoDStroke,
#endif

kCellUpperLeft,
Expand Down Expand Up @@ -1086,6 +1094,8 @@ LOCALVAR const char Cell2MacAsciiMap[] = {
'\171', /* kCellLoYAcute */
'\165', /* kCellLoUDblac */
'\165', /* kCellLoURing */
'\104', /* kCellUpDStroke */
'\144', /* kCellLoDStroke */
#endif

'\0' /* just so last above line can end in ',' */
Expand Down Expand Up @@ -1279,6 +1289,8 @@ LOCALVAR const ui3b Cell2WinAsciiMap[] = {
0xFD, /* kCellLoYAcute */
0x75, /* kCellLoUDblac */
0x75, /* kCellLoURing */
0x44, /* kCellUpDStroke */
0x64, /* kCellLoDStroke */
#endif

'\0' /* just so last above line can end in ',' */
Expand Down Expand Up @@ -1472,6 +1484,8 @@ LOCALVAR const char Cell2PlainAsciiMap[] = {
'y', /* kCellLoYAcute */
'u', /* kCellLoUDblac */
'u', /* kCellLoURing */
'D', /* kCellUpDStroke */
'd', /* kCellLoDStroke */
#endif

'\0' /* just so last above line can end in ',' */
Expand Down Expand Up @@ -1665,6 +1679,8 @@ LOCALVAR const ui4b Cell2UnicodeMap[] = {
0x00FD, /* kCellLoYAcute */
0x0171, /* kCellLoUDblac */
0x016F, /* kCellLoURing */
0x0110, /* kCellUpDStroke */
0x0111, /* kCellLoDStroke */
#endif

'\0' /* just so last above line can end in ',' */
Expand Down Expand Up @@ -1876,6 +1892,8 @@ LOCALPROC ClStrAppendSubstCStr(int *L, ui3b *r, char *s)
switch (*p++) {
case 'A': x = kCellUpACedille; break;
case 'a': x = kCellLoACedille; break;
case 'D': x = kCellUpDStroke; break;
case 'd': x = kCellLoDStroke; break;
case 'E': x = kCellUpECedille; break;
case 'e': x = kCellLoECedille; break;
case 'L': x = kCellUpLBar; break;
Expand Down
21 changes: 21 additions & 0 deletions src/OSGLUCCO.m
Original file line number Diff line number Diff line change
Expand Up @@ -1230,12 +1230,33 @@ LOCALFUNC tMacErr LoadMacRomFromPrefDir(void)
return err;
}

LOCALFUNC tMacErr LoadMacRomFromGlobalDir(void)
{
NSString *GryphelPath;
NSString *RomsPath;
tMacErr err = mnvm_fnfErr;
NSArray *paths = NSSearchPathForDirectoriesInDomains(
NSApplicationSupportDirectory, NSLocalDomainMask, NO);
if ((nil != paths) && ([paths count] > 0))
{
NSString *LibPath = [paths objectAtIndex:0];
if (FindNamedChildDirPath(LibPath, "Gryphel", &GryphelPath))
if (FindNamedChildDirPath(GryphelPath, "mnvm_rom", &RomsPath))
{
err = LoadMacRomFrom(RomsPath);
}
}

return err;
}

LOCALFUNC blnr LoadMacRom(void)
{
tMacErr err;

if (mnvm_fnfErr == (err = LoadMacRomFromAppDir()))
if (mnvm_fnfErr == (err = LoadMacRomFromPrefDir()))
if (mnvm_fnfErr == (err = LoadMacRomFromGlobalDir()))
{
}

Expand Down
Loading

0 comments on commit 5329b84

Please sign in to comment.