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.7 by gbeauche, 2003-12-04T17:26:35Z vs.
Revision 1.10 by gbeauche, 2004-01-26T22:04:01Z

# Line 1 | Line 1
1   /*
2   *  rsrc_patches.cpp - Resource patches
3   *
4 < *  SheepShaver (C) 1997-2002 Christian Bauer and Marc Hellwig
4 > *  SheepShaver (C) 1997-2004 Christian Bauer and Marc Hellwig
5   *
6   *  This program is free software; you can redistribute it and/or modify
7   *  it under the terms of the GNU General Public License as published by
# Line 31 | Line 31
31   #include "rom_patches.h"
32   #include "main.h"
33   #include "audio.h"
34 + #include "audio_defs.h"
35   #include "thunks.h"
36  
37   #define DEBUG 0
# Line 448 | Line 449 | void CheckLoad(uint32 type, int16 id, ui
449  
450          } else if (type == FOURCC('t','h','n','g')) {
451                  // Collect info about used audio sifters
452 <                uint32 c_type = ntohl(0[(uint32 *)p]);
453 <                uint32 sub_type = ntohl(1[(uint32 *)p]);
452 >                uint32 thing = (uintptr)p;
453 >                uint32 c_type = ReadMacInt32(thing);
454 >                uint32 sub_type = ReadMacInt32(thing + 4);
455                  if (c_type == FOURCC('s','d','e','v') && sub_type == FOURCC('s','i','n','g')) {
456 <                        1[(uint32 *)p] = htonl(FOURCC('a','w','g','c'));
456 >                        WriteMacInt32(thing + 4, FOURCC('a','w','g','c'));
457                          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));
458 <                        AddSifter(ReadMacInt32(((uintptr)p)+20), ntohs(p[12]));
459 <                        if (ntohs(p[28]))                                                       // componentPFCount
460 <                                AddSifter(ReadMacInt32(((uintptr)p)+62), ntohs(p[33]));
458 >                        AddSifter(ReadMacInt32(thing + componentResType), ReadMacInt16(thing + componentResID));
459 >                        if (ReadMacInt32(thing + componentPFCount))
460 >                                AddSifter(ReadMacInt32(thing + componentPFResType), ReadMacInt16(thing + componentPFResID));
461                  }
462  
463          } else if (type == FOURCC('s','i','f','t') || type == FOURCC('n','i','f','t')) {
# Line 505 | Line 507 | void CheckLoad(uint32 type, int16 id, ui
507                          p16[1] = htons(M68K_RTS);
508                          D(bug(" patch 1 applied\n"));
509                  }
510 +
511 +        } else if (type == FOURCC('N','O','b','j') && id == 100) {
512 +                D(bug("NObj 100 found\n"));
513 +
514 +                // Don't access VIA registers in MacBench 5.0
515 +                static const uint8 dat1[] = {0x7c, 0x08, 0x02, 0xa6, 0xbf, 0x01, 0xff, 0xe0, 0x90, 0x01, 0x00, 0x08};
516 +                base = find_rsrc_data((uint8 *)p, size, dat1, sizeof(dat1));
517 +                if (base) {
518 +                        p[(base + 0x00) >> 1] = htons(0x3860);          // li r3,0
519 +                        p[(base + 0x02) >> 1] = htons(0x0000);
520 +                        p[(base + 0x04) >> 1] = htons(0x4e80);          // blr
521 +                        p[(base + 0x06) >> 1] = htons(0x0020);
522 +                        D(bug(" patch 1 applied\n"));
523 +                }
524 +                static const uint8 dat2[] = {0x7c, 0x6c, 0x1b, 0x78, 0x7c, 0x8b, 0x23, 0x78, 0x38, 0xc0, 0x3f, 0xfd};
525 +                base = find_rsrc_data((uint8 *)p, size, dat2, sizeof(dat2));
526 +                if (base) {
527 +                        p[(base + 0x00) >> 1] = htons(0x3860);          // li r3,0
528 +                        p[(base + 0x02) >> 1] = htons(0x0000);
529 +                        p[(base + 0x04) >> 1] = htons(0x4e80);          // blr
530 +                        p[(base + 0x06) >> 1] = htons(0x0020);
531 +                        D(bug(" patch 2 applied\n"));
532 +                }
533          }
534   }
535  

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines