mirror of
https://github.com/elliotnunn/supermario.git
synced 2024-06-26 07:29:29 +00:00
More OF functions
This commit is contained in:
parent
63a7654660
commit
b5ebad1958
|
@ -22817,20 +22817,28 @@ diff --git a/OS/StartMgr/OpenFirmware.c b/OS/StartMgr/OpenFirmware.c
|
|||
new file mode 100644
|
||||
--- /dev/null
|
||||
+++ b/OS/StartMgr/OpenFirmware.c
|
||||
@@ -0,0 +1,163 @@
|
||||
@@ -0,0 +1,304 @@
|
||||
+#include <CodeFragments.h>
|
||||
+#include <NameRegistry.h>
|
||||
+#include <NameRegistryPriv.h>
|
||||
+#include <ExpandMemPriv.h>
|
||||
+#include <Resources.h>
|
||||
+#include <Memory.h>
|
||||
+
|
||||
+
|
||||
+struct mystruct {
|
||||
+ long l1;
|
||||
+ char *l2;
|
||||
+ RegPropertyValueSize l3;
|
||||
+ Ptr frag_ptr;
|
||||
+ long frag_size;
|
||||
+ short sh;
|
||||
+ char c1; char c2;
|
||||
+};
|
||||
+
|
||||
+struct USBGlobals {
|
||||
+ long unsure;
|
||||
+ CFragConnectionID expert_conn;
|
||||
+};
|
||||
+
|
||||
+pascal short CFM_4(struct mystruct *, long, char *, char) = {0x3F3C, 0xFFFC, 0xAA5A};
|
||||
+
|
||||
+void
|
||||
|
@ -22850,7 +22858,7 @@ new file mode 100644
|
|||
+}
|
||||
+
|
||||
+OSErr
|
||||
+INTERC_1230(char *arg1, RegPropertyValueSize arg2, char *cLibName, long arg4) /* PrepareByName */
|
||||
+INTERC_1230(Ptr frag_ptr, long frag_size, char *cLibName, long doprepare) /* PrepareByName */
|
||||
+{
|
||||
+ struct mystruct mystruct;
|
||||
+ CFragConnectionID connid; Ptr code;
|
||||
|
@ -22861,13 +22869,13 @@ new file mode 100644
|
|||
+ c2pstr(pLibName);
|
||||
+
|
||||
+ mystruct.l1 = 0;
|
||||
+ mystruct.l2 = arg1;
|
||||
+ mystruct.l3 = arg2;
|
||||
+ mystruct.frag_ptr = frag_ptr;
|
||||
+ mystruct.frag_size = frag_size;
|
||||
+ mystruct.sh = 0;
|
||||
+ mystruct.c1 = 0;
|
||||
+ mystruct.c2 = 0;
|
||||
+
|
||||
+ if (!(err = CFM_4(&mystruct, 0, pLibName, 0)) && (char)arg4) {
|
||||
+ if (!(err = CFM_4(&mystruct, 0, pLibName, 0)) && (char)doprepare) {
|
||||
+ pErrMessage[0] = 0;
|
||||
+ err = GetSharedLibrary(pLibName, kPowerPCCFragArch, kReferenceCFrag, &connid, &code, pErrMessage);
|
||||
+ }
|
||||
|
@ -22876,7 +22884,7 @@ new file mode 100644
|
|||
+}
|
||||
+
|
||||
+OSErr
|
||||
+INTERC_12E0_CODEPREPARE(char *codePrepareName, Boolean passthruArg) /* PrepareInOrder */
|
||||
+INTERC_12E0_CODEPREPARE(char *codePrepareName, Boolean doprepare) /* PrepareInOrder */
|
||||
+{
|
||||
+ RegPropertyIter cookie;
|
||||
+ RegEntryID theNode;
|
||||
|
@ -22893,7 +22901,7 @@ new file mode 100644
|
|||
+
|
||||
+ prepOrder = 0; prepOrderLen = 0;
|
||||
+
|
||||
+ if (!err && passthruArg) {
|
||||
+ if (!err && doprepare) {
|
||||
+ err = RegistryPropertyGetPtr(&theNode, "AAPL,prepare_order", &prepOrder, &prepOrderLen);
|
||||
+ if (err) {
|
||||
+ err = 0;
|
||||
|
@ -22901,7 +22909,7 @@ new file mode 100644
|
|||
+ for (fragToPrep = prepOrder; fragToPrep < prepOrder + prepOrderLen; fragToPrep += strlen(fragToPrep) + 1) {
|
||||
+ err = RegistryPropertyGetPtr(&theNode, fragToPrep, &propName, &propNameLen);
|
||||
+ if (!err) {
|
||||
+ err = INTERC_1230(propName, propNameLen, fragToPrep, passthruArg);
|
||||
+ err = INTERC_1230(propName, propNameLen, fragToPrep, doprepare);
|
||||
+ }
|
||||
+ }
|
||||
+ err = 0;
|
||||
|
@ -22926,7 +22934,7 @@ new file mode 100644
|
|||
+ if (!alreadyPrepared) {
|
||||
+ err = RegistryPropertyGetPtr(&theNode, curPropName, &propName, &propNameLen);
|
||||
+ if (!err) {
|
||||
+ err = INTERC_1230(propName, propNameLen, curPropName, passthruArg);
|
||||
+ err = INTERC_1230(propName, propNameLen, curPropName, doprepare);
|
||||
+ }
|
||||
+ }
|
||||
+ }
|
||||
|
@ -22941,7 +22949,7 @@ new file mode 100644
|
|||
+}
|
||||
+
|
||||
+OSErr
|
||||
+INTERC_14E0(const RegPropertyName *prop1, const RegPropertyName *prop2, Boolean arg3)
|
||||
+INTERC_14E0(const RegPropertyName *prop1, const RegPropertyName *prop2, Boolean doprepare)
|
||||
+{
|
||||
+ RegEntryIter cookie;
|
||||
+ RegEntryID node;
|
||||
|
@ -22970,7 +22978,7 @@ new file mode 100644
|
|||
+ if (suberr = RegistryPropertyGetPtr(&node, prop1, &prop1_val, &prop1_size)) continue;
|
||||
+ if (suberr = RegistryPropertyGetPtr(&node, prop2, &prop2_val, &prop2_size)) continue;
|
||||
+
|
||||
+ INTERC_1230(prop1_val, prop1_size, prop2_val, arg3);
|
||||
+ INTERC_1230(prop1_val, prop1_size, prop2_val, doprepare);
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
|
@ -22980,6 +22988,139 @@ new file mode 100644
|
|||
+ return err;
|
||||
+}
|
||||
+
|
||||
+OSErr
|
||||
+CODEPREPARE(void)
|
||||
+{
|
||||
+ OSErr err;
|
||||
+ char str[128];
|
||||
+
|
||||
+ err = INTERC_14E0("pef,AAPL,MacOS,PowerPC,prepare", "code,AAPL,MacOS,name", 1);
|
||||
+ if (!err) {
|
||||
+ strcpy(str, "Devices:device-tree:");
|
||||
+ strcat(str, "AAPL,CodePrepare");
|
||||
+ err = INTERC_12E0_CODEPREPARE(str, 1);
|
||||
+ }
|
||||
+
|
||||
+ return err;
|
||||
+}
|
||||
+
|
||||
+OSErr
|
||||
+CODEREGISTER(void)
|
||||
+{
|
||||
+ OSErr err;
|
||||
+ char str[128];
|
||||
+
|
||||
+ err = INTERC_14E0("pef,AAPL,MacOS,PowerPC,register", "code,AAPL,MacOS,name", 0);
|
||||
+ if (!err) {
|
||||
+ strcpy(str, "Devices:device-tree:");
|
||||
+ strcat(str, "AAPL,CodeRegister");
|
||||
+ err = INTERC_12E0_CODEPREPARE(str, 0);
|
||||
+ }
|
||||
+
|
||||
+ return err;
|
||||
+}
|
||||
+
|
||||
+OSErr
|
||||
+INTERC_1750_LANLIB(void)
|
||||
+{
|
||||
+ struct mystruct mystruct;
|
||||
+ RegPropertyValueSize frag_size;
|
||||
+ Ptr frag_ptr;
|
||||
+ RegEntryIter cookie;
|
||||
+ RegEntryID id;
|
||||
+ Boolean srchdone;
|
||||
+ long err = -2539;
|
||||
+
|
||||
+ RegistryEntryIDInit(&id);
|
||||
+ RegistryEntryIterateCreate(&cookie);
|
||||
+
|
||||
+ srchdone = 0;
|
||||
+ while (err && !srchdone)
|
||||
+ {
|
||||
+ const char *ethernet_str = "ethernet";
|
||||
+ long srcherr;
|
||||
+ long regerr;
|
||||
+
|
||||
+ srcherr = RegistryEntrySearch(
|
||||
+ &cookie, kRegIterContinue, &id, &srchdone, "name", ethernet_str, /*len*/9);
|
||||
+
|
||||
+ if (!srcherr && !srchdone) {
|
||||
+ regerr = 0;
|
||||
+
|
||||
+ frag_size = 0;
|
||||
+ if (!regerr) regerr = RegistryPropertyGetSize(&id, "lanLib,AAPL,MacOS,PowerPC", &frag_size);
|
||||
+
|
||||
+ if (!regerr) {
|
||||
+ frag_ptr = NewPtrSys(frag_size); //a4
|
||||
+ if (frag_ptr) {
|
||||
+ regerr = RegistryPropertyGet(&id, "lanLib,AAPL,MacOS,PowerPC", frag_ptr, &frag_size);
|
||||
+ if (!regerr) {
|
||||
+ mystruct.l1 = 0;
|
||||
+ mystruct.frag_ptr = frag_ptr;
|
||||
+ mystruct.frag_size = frag_size;
|
||||
+ mystruct.sh = 0;
|
||||
+ mystruct.c1 = 0;
|
||||
+ mystruct.c2 = 0;
|
||||
+ CFM_4(&mystruct, 0, "\planLib", 0);
|
||||
+ }
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ if (!regerr) err = 0;
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ RegistryEntryIterateDispose(&cookie);
|
||||
+ RegistryEntryIDDispose(&id);
|
||||
+
|
||||
+ return err;
|
||||
+}
|
||||
+
|
||||
+void
|
||||
+INITLANDISK(void)
|
||||
+{
|
||||
+ Handle dfrg_hdl;
|
||||
+ THz old_zone;
|
||||
+ CFragConnectionID conn;
|
||||
+ Ptr code;
|
||||
+ Str255 err_str;
|
||||
+
|
||||
+ old_zone = GetZone();
|
||||
+ SetZone(SystemZone());
|
||||
+
|
||||
+ INTERC_1750_LANLIB();
|
||||
+
|
||||
+ TempInsertROMMap(1);
|
||||
+ if (dfrg_hdl = GetResource('dfrg', -20722)) {
|
||||
+ long dfrg_size = SizeResource(dfrg_hdl);
|
||||
+ OSErr err = GetMemFragment(
|
||||
+ *dfrg_hdl, dfrg_size, "\pLANDisk", kReferenceCFrag, &conn, &code, err_str);
|
||||
+ }
|
||||
+
|
||||
+ SetZone(old_zone);
|
||||
+}
|
||||
+
|
||||
+void
|
||||
+INITUSB(void)
|
||||
+{
|
||||
+ THz old_zone;
|
||||
+ struct USBGlobals *glob;
|
||||
+ Ptr code;
|
||||
+ Str255 err_str;
|
||||
+
|
||||
+ old_zone = GetZone();
|
||||
+ SetZone(SystemZone());
|
||||
+
|
||||
+ if (glob = (void *)NewPtrSys(sizeof *glob)) {
|
||||
+ if (!GetSharedLibrary(
|
||||
+ "\pUSBFamilyExpertLib", kPowerPCCFragArch, kReferenceCFrag, &(glob->expert_conn), &code, err_str)) {
|
||||
+ (GetExpandMem())->emUSBGlobals = (Ptr)glob;
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ SetZone(old_zone);
|
||||
+}
|
||||
+
|
||||
+/* This file is complete... the remaining kilobytes to 0x2BC0 are filled by Amphibian DNA */
|
||||
diff --git a/OS/StartMgr/OpenFirmware.c.idump b/OS/StartMgr/OpenFirmware.c.idump
|
||||
new file mode 100644
|
||||
|
|
Loading…
Reference in New Issue
Block a user