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.5 by gbeauche, 2003-09-29T22:48:22Z vs.
Revision 1.7 by gbeauche, 2003-12-04T17:26:35Z

# Line 31 | Line 31
31   #include "rom_patches.h"
32   #include "main.h"
33   #include "audio.h"
34 + #include "thunks.h"
35  
36   #define DEBUG 0
37   #include "debug.h"
# Line 420 | Line 421 | void CheckLoad(uint32 type, int16 id, ui
421  
422          } else if (type == FOURCC('n','s','r','d') && id == 1) {
423                  D(bug("nsrd 1 found\n"));
424 <                if (p[(0x378 + 0x570) >> 1] == 0x7c08 && p[(0x37a + 0x570) >> 1] == 0x02a6) {
424 >                if (p[(0x378 + 0x570) >> 1] == htons(0x7c08) && p[(0x37a + 0x570) >> 1] == htons(0x02a6)) {
425                          // Don't overwrite our serial drivers (8.0, 8.1)
426 <                        p[(0x378 + 0x570) >> 1] = 0x4e80;               // blr
427 <                        p[(0x37a + 0x570) >> 1] = 0x0020;
426 >                        p[(0x378 + 0x570) >> 1] = htons(0x4e80);                // blr
427 >                        p[(0x37a + 0x570) >> 1] = htons(0x0020);
428                          D(bug(" patch 1 applied\n"));
429 <                } else if (p[(0x378 + 0x6c0) >> 1] == 0x7c08 && p[(0x37a + 0x6c0) >> 1] == 0x02a6) {
429 >                } else if (p[(0x378 + 0x6c0) >> 1] == htons(0x7c08) && p[(0x37a + 0x6c0) >> 1] == htons(0x02a6)) {
430                          // Don't overwrite our serial drivers (8.5, 8.6)
431 <                        p[(0x378 + 0x6c0) >> 1] = 0x4e80;               // blr
432 <                        p[(0x37a + 0x6c0) >> 1] = 0x0020;
431 >                        p[(0x378 + 0x6c0) >> 1] = htons(0x4e80);                // blr
432 >                        p[(0x37a + 0x6c0) >> 1] = htons(0x0020);
433                          D(bug(" patch 2 applied\n"));
434                  }
435  
# Line 438 | Line 439 | void CheckLoad(uint32 type, int16 id, ui
439                  while (size--) {
440                          if (PM(0,0x203c) && PM(1,0x0100) && PM(2,0x0000) && PM(3,0xc0ae) && PM(4,0xfffc)) {
441                                  // Don't replace SCSI Manager (8.1, 8.5, 8.6)
442 <                                p[5] = htons((p[5] & 0xff) | 0x6000);           // beq
442 >                                p[5] = htons((ntohs(p[5]) & 0xff) | 0x6000);            // beq
443                                  D(bug(" patch 1 applied\n"));
444                                  break;
445                          }
# Line 447 | Line 448 | void CheckLoad(uint32 type, int16 id, ui
448  
449          } else if (type == FOURCC('t','h','n','g')) {
450                  // Collect info about used audio sifters
451 <                uint32 c_type = 0[(uint32 *)p];
452 <                uint32 sub_type = 1[(uint32 *)p];
451 >                uint32 c_type = ntohl(0[(uint32 *)p]);
452 >                uint32 sub_type = ntohl(1[(uint32 *)p]);
453                  if (c_type == FOURCC('s','d','e','v') && sub_type == FOURCC('s','i','n','g')) {
454 <                        1[(uint32 *)p] = FOURCC('a','w','g','c');
454 >                        1[(uint32 *)p] = htonl(FOURCC('a','w','g','c'));
455                          D(bug("thng %d, type %c%c%c%c (%08x), sub type %c%c%c%c (%08x), data %p\n", id, c_type >> 24, (c_type >> 16) & 0xff, (c_type >> 8) & 0xff, c_type & 0xff, c_type, sub_type >> 24, (sub_type >> 16) & 0xff, (sub_type >> 8) & 0xff, sub_type & 0xff, sub_type, p));
456 <                        AddSifter(*(uint32 *)(((uintptr)p)+20), p[12]);
457 <                        if (p[28])                                                              // componentPFCount
458 <                                AddSifter(*(uint32 *)(((uintptr)p)+62), p[33]);
456 >                        AddSifter(ReadMacInt32(((uintptr)p)+20), ntohs(p[12]));
457 >                        if (ntohs(p[28]))                                                       // componentPFCount
458 >                                AddSifter(ReadMacInt32(((uintptr)p)+62), ntohs(p[33]));
459                  }
460  
461          } else if (type == FOURCC('s','i','f','t') || type == FOURCC('n','i','f','t')) {
# Line 716 | Line 717 | void PatchNativeResourceManager(void)
717          *(uint32 *)XLM_RES_LIB_TOC = tvec[1];
718          *(uint32 *)XLM_GET_RESOURCE = tvec[0];
719   #if EMULATED_PPC
720 <        tvec[0] = htonl(POWERPC_NATIVE_OP_FUNC(NATIVE_GET_RESOURCE));
720 >        tvec[0] = htonl(NativeFunction(NATIVE_GET_RESOURCE));
721   #else
722   #ifdef __BEOS__
723          uint32 *tvec2 = (uint32 *)get_resource;
# Line 733 | Line 734 | void PatchNativeResourceManager(void)
734          D(bug(" Get1Resource() entry %08x, TOC %08x\n", ntohl(tvec[0]), ntohl(tvec[1])));
735          *(uint32 *)XLM_GET_1_RESOURCE = tvec[0];
736   #if EMULATED_PPC
737 <        tvec[0] = htonl(POWERPC_NATIVE_OP_FUNC(NATIVE_GET_1_RESOURCE));
737 >        tvec[0] = htonl(NativeFunction(NATIVE_GET_1_RESOURCE));
738   #else
739   #ifdef __BEOS__
740          tvec2 = (uint32 *)get_1_resource;
# Line 750 | Line 751 | void PatchNativeResourceManager(void)
751          D(bug(" GetIndResource() entry %08x, TOC %08x\n", ntohl(tvec[0]), ntohl(tvec[1])));
752          *(uint32 *)XLM_GET_IND_RESOURCE = tvec[0];
753   #if EMULATED_PPC
754 <        tvec[0] = htonl(POWERPC_NATIVE_OP_FUNC(NATIVE_GET_IND_RESOURCE));
754 >        tvec[0] = htonl(NativeFunction(NATIVE_GET_IND_RESOURCE));
755   #else
756   #ifdef __BEOS__
757          tvec2 = (uint32 *)get_ind_resource;
# Line 767 | Line 768 | void PatchNativeResourceManager(void)
768          D(bug(" Get1IndResource() entry %08x, TOC %08x\n", ntohl(tvec[0]), ntohl(tvec[1])));
769          *(uint32 *)XLM_GET_1_IND_RESOURCE = tvec[0];
770   #if EMULATED_PPC
771 <        tvec[0] = htonl(POWERPC_NATIVE_OP_FUNC(NATIVE_GET_1_IND_RESOURCE));
771 >        tvec[0] = htonl(NativeFunction(NATIVE_GET_1_IND_RESOURCE));
772   #else
773   #ifdef __BEOS__
774          tvec2 = (uint32 *)get_1_ind_resource;
# Line 784 | Line 785 | void PatchNativeResourceManager(void)
785          D(bug(" RGetResource() entry %08x, TOC %08x\n", ntohl(tvec[0]), ntohl(tvec[1])));
786          *(uint32 *)XLM_R_GET_RESOURCE = tvec[0];
787   #if EMULATED_PPC
788 <        tvec[0] = htonl(POWERPC_NATIVE_OP_FUNC(NATIVE_R_GET_RESOURCE));
788 >        tvec[0] = htonl(NativeFunction(NATIVE_R_GET_RESOURCE));
789   #else
790   #ifdef __BEOS__
791          tvec2 = (uint32 *)r_get_resource;

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines