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

Comparing BasiliskII/src/rsrc_patches.cpp (file contents):
Revision 1.14 by gbeauche, 2006-02-19T14:18:29Z vs.
Revision 1.15 by gbeauche, 2006-04-30T21:16:48Z

# Line 24 | Line 24
24   #include "cpu_emulation.h"
25   #include "macos_util.h"
26   #include "main.h"
27 + #include "prefs.h"
28   #include "emul_op.h"
29   #include "audio.h"
30   #include "audio_defs.h"
# Line 53 | Line 54 | static uint32 find_rsrc_data(const uint8
54  
55  
56   /*
57 + *  Install SynchIdleTime() patch
58 + */
59 +
60 + static void patch_idle_time(uint8 *p, uint32 size, int n = 1)
61 + {
62 +        if (!PrefsFindBool("idlewait"))
63 +                return;
64 +
65 +        static const uint8 dat[] = {0x70, 0x03, 0xa0, 0x9f};
66 +        uint32 base = find_rsrc_data(p, size, dat, sizeof(dat));
67 +        if (base) {
68 +                uint8 *pbase = p + base - 0x80;
69 +                static const uint8 dat2[] = {0x20, 0x78, 0x02, 0xb6, 0x41, 0xe8, 0x00, 0x80};
70 +                base = find_rsrc_data(pbase, 0x80, dat2, sizeof(dat2));
71 +                if (base) {
72 +                        uint16 *p16 = (uint16 *)(pbase + base);
73 +                        *p16++ = htons(M68K_EMUL_OP_IDLE_TIME);
74 +                        *p16 = htons(M68K_NOP);
75 +                        FlushCodeCache(pbase + base, 4);
76 +                        D(bug("  patch %d applied\n", n));
77 +                }
78 +        }
79 + }
80 +
81 +
82 + /*
83   *  Resource patches via vCheckLoad
84   */
85  
# Line 204 | Line 231 | void CheckLoad(uint32 type, int16 id, ui
231                          D(bug("  patch 1 applied\n"));
232                  }
233  
234 +                // Patch SynchIdleTime()
235 +                patch_idle_time(p, size, 2);
236 +
237          } else if (type == FOURCC('l','p','c','h') && id == 24) {
238                  D(bug(" lpch 24 found\n"));
239  
# Line 246 | Line 276 | void CheckLoad(uint32 type, int16 id, ui
276                          D(bug("  patch 2 applied\n"));
277                  }
278  
279 +                // Patch SynchIdleTime()
280 +                patch_idle_time(p, size, 3);
281 +
282          } else if (type == FOURCC('t','h','n','g') && id == -16563) {
283                  D(bug(" thng -16563 found\n"));
284  

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines