/[cebix]/SheepShaver/src/rsrc_patches.cpp
ViewVC logotype

Diff of /SheepShaver/src/rsrc_patches.cpp

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

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

Legend:
Removed from v.1.4  
changed lines
  Added in v.1.5

Christian Bauer">Christian Bauer
ViewVC Help
Powered by ViewVC 1.1.15