ViewVC Help
View File | Revision Log | Show Annotations | Revision Graph | Root Listing
root/cebix/SheepShaver/src/rsrc_patches.cpp
(Generate patch)

Comparing SheepShaver/src/rsrc_patches.cpp (file contents):
Revision 1.4 by gbeauche, 2003-09-29T20:30:19Z vs.
Revision 1.5 by gbeauche, 2003-09-29T22:48:22Z

# Line 517 | Line 517 | static
517   #else
518   extern "C"
519   #endif
520 < void check_load_invoc(uint32 type, int16 id, uint16 **h)
520 > void check_load_invoc(uint32 type, int16 id, uint32 h)
521   {
522 <        if (h == NULL)
522 >        if (h == 0)
523                  return;
524 <        uint16 *p = *h;
525 <        if (p == NULL)
524 >        uint32 p = ReadMacInt32(h);
525 >        if (p == 0)
526                  return;
527 <        uint32 size = ((uint32 *)p)[-2] & 0xffffff;
527 >        uint32 size = ReadMacInt32(p - 2 * 4) & 0xffffff;
528  
529 <        CheckLoad(type, id, p, size);
529 >        CheckLoad(type, id, (uint16 *)p, size);
530   }
531  
532   #ifdef __BEOS__
# Line 708 | Line 708 | void PatchNativeResourceManager(void)
708          D(bug("PatchNativeResourceManager\n"));
709  
710          // Patch native GetResource()
711 <        uint32 **upp = (uint32 **)(uintptr)ReadMacInt32(0x1480);
712 <        if (((uint32)upp & 0xffc00000) == ROM_BASE)
711 >        uint32 upp = ReadMacInt32(0x1480);
712 >        if ((upp & 0xffc00000) == ROM_BASE)
713                  return;
714 <        uint32 *tvec = upp[5];
715 <        D(bug(" GetResource() entry %08x, TOC %08x\n", tvec[0], tvec[1]));
714 >        uint32 *tvec = (uint32 *)ReadMacInt32(upp + 5 * 4);
715 >        D(bug(" GetResource() entry %08x, TOC %08x\n", ntohl(tvec[0]), ntohl(tvec[1])));
716          *(uint32 *)XLM_RES_LIB_TOC = tvec[1];
717          *(uint32 *)XLM_GET_RESOURCE = tvec[0];
718   #if EMULATED_PPC
719 <        tvec[0] = POWERPC_NATIVE_OP_FUNC(NATIVE_GET_RESOURCE);
719 >        tvec[0] = htonl(POWERPC_NATIVE_OP_FUNC(NATIVE_GET_RESOURCE));
720   #else
721   #ifdef __BEOS__
722          uint32 *tvec2 = (uint32 *)get_resource;
# Line 728 | Line 728 | void PatchNativeResourceManager(void)
728   #endif
729  
730          // Patch native Get1Resource()
731 <        upp = *(uint32 ***)0xe7c;
732 <        tvec = upp[5];
733 <        D(bug(" Get1Resource() entry %08x, TOC %08x\n", tvec[0], tvec[1]));
731 >        upp = ReadMacInt32(0x0e7c);
732 >        tvec = (uint32 *)ReadMacInt32(upp + 5 * 4);
733 >        D(bug(" Get1Resource() entry %08x, TOC %08x\n", ntohl(tvec[0]), ntohl(tvec[1])));
734          *(uint32 *)XLM_GET_1_RESOURCE = tvec[0];
735   #if EMULATED_PPC
736 <        tvec[0] = POWERPC_NATIVE_OP_FUNC(NATIVE_GET_1_RESOURCE);
736 >        tvec[0] = htonl(POWERPC_NATIVE_OP_FUNC(NATIVE_GET_1_RESOURCE));
737   #else
738   #ifdef __BEOS__
739          tvec2 = (uint32 *)get_1_resource;
# Line 745 | Line 745 | void PatchNativeResourceManager(void)
745   #endif
746  
747          // Patch native GetIndResource()
748 <        upp = *(uint32 ***)0x1474;
749 <        tvec = upp[5];
750 <        D(bug(" GetIndResource() entry %08x, TOC %08x\n", tvec[0], tvec[1]));
748 >        upp = ReadMacInt32(0x1474);
749 >        tvec = (uint32 *)ReadMacInt32(upp + 5 * 4);
750 >        D(bug(" GetIndResource() entry %08x, TOC %08x\n", ntohl(tvec[0]), ntohl(tvec[1])));
751          *(uint32 *)XLM_GET_IND_RESOURCE = tvec[0];
752   #if EMULATED_PPC
753 <        tvec[0] = POWERPC_NATIVE_OP_FUNC(NATIVE_GET_IND_RESOURCE);
753 >        tvec[0] = htonl(POWERPC_NATIVE_OP_FUNC(NATIVE_GET_IND_RESOURCE));
754   #else
755   #ifdef __BEOS__
756          tvec2 = (uint32 *)get_ind_resource;
# Line 762 | Line 762 | void PatchNativeResourceManager(void)
762   #endif
763  
764          // Patch native Get1IndResource()
765 <        upp = *(uint32 ***)0xe38;
766 <        tvec = upp[5];
767 <        D(bug(" Get1IndResource() entry %08x, TOC %08x\n", tvec[0], tvec[1]));
765 >        upp = ReadMacInt32(0x0e38);
766 >        tvec = (uint32 *)ReadMacInt32(upp + 5 * 4);
767 >        D(bug(" Get1IndResource() entry %08x, TOC %08x\n", ntohl(tvec[0]), ntohl(tvec[1])));
768          *(uint32 *)XLM_GET_1_IND_RESOURCE = tvec[0];
769   #if EMULATED_PPC
770 <        tvec[0] = POWERPC_NATIVE_OP_FUNC(NATIVE_GET_1_IND_RESOURCE);
770 >        tvec[0] = htonl(POWERPC_NATIVE_OP_FUNC(NATIVE_GET_1_IND_RESOURCE));
771   #else
772   #ifdef __BEOS__
773          tvec2 = (uint32 *)get_1_ind_resource;
# Line 779 | Line 779 | void PatchNativeResourceManager(void)
779   #endif
780  
781          // Patch native RGetResource()
782 <        upp = *(uint32 ***)0xe30;
783 <        tvec = upp[5];
784 <        D(bug(" RGetResource() entry %08x, TOC %08x\n", tvec[0], tvec[1]));
782 >        upp = ReadMacInt32(0x0e30);
783 >        tvec = (uint32 *)ReadMacInt32(upp + 5 * 4);
784 >        D(bug(" RGetResource() entry %08x, TOC %08x\n", ntohl(tvec[0]), ntohl(tvec[1])));
785          *(uint32 *)XLM_R_GET_RESOURCE = tvec[0];
786   #if EMULATED_PPC
787 <        tvec[0] = POWERPC_NATIVE_OP_FUNC(NATIVE_R_GET_RESOURCE);
787 >        tvec[0] = htonl(POWERPC_NATIVE_OP_FUNC(NATIVE_R_GET_RESOURCE));
788   #else
789   #ifdef __BEOS__
790          tvec2 = (uint32 *)r_get_resource;

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines