~ubuntu-branches/ubuntu/feisty/basilisk2/feisty

« back to all changes in this revision

Viewing changes to src/rsrc_patches.cpp

  • Committer: Bazaar Package Importer
  • Author(s): Jonas Smedegaard
  • Date: 2006-06-01 01:11:16 UTC
  • mfrom: (1.1.2 upstream)
  • Revision ID: james.westby@ubuntu.com-20060601011116-xjhegbgyfsxag5fl
Tags: 0.9.20060529-1
* New upstream CVS snapshot.
* Update local cdbs snippet copyright-check.mk:
  + Broaden scan to also look for "(c)" by default.
  + Make egrep options configurable.
  + Ignore auto-tools files.
* Bump up standards-version to 3.7.2 (no changes needed).
* Let dh_strip do the stripping (not the make install target).

Show diffs side-by-side

added added

removed removed

Lines of Context:
24
24
#include "cpu_emulation.h"
25
25
#include "macos_util.h"
26
26
#include "main.h"
 
27
#include "prefs.h"
27
28
#include "emul_op.h"
28
29
#include "audio.h"
29
30
#include "audio_defs.h"
53
54
 
54
55
 
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
/*
56
83
 *  Resource patches via vCheckLoad
57
84
 */
58
85
 
204
231
                        D(bug("  patch 1 applied\n"));
205
232
                }
206
233
 
 
234
                // Patch SynchIdleTime()
 
235
                patch_idle_time(p, size, 2);
 
236
 
207
237
        } else if (type == FOURCC('l','p','c','h') && id == 24) {
208
238
                D(bug(" lpch 24 found\n"));
209
239
 
246
276
                        D(bug("  patch 2 applied\n"));
247
277
                }
248
278
 
 
279
                // Patch SynchIdleTime()
 
280
                patch_idle_time(p, size, 3);
 
281
 
249
282
        } else if (type == FOURCC('t','h','n','g') && id == -16563) {
250
283
                D(bug(" thng -16563 found\n"));
251
284
 
306
339
                *p16 = htons(M68K_RTS);
307
340
                FlushCodeCache(p, 6);
308
341
                D(bug("  patch 1 applied\n"));
309
 
        }
310
 
#if REAL_ADDRESSING && !defined(AMIGA)
311
 
        else if (type == FOURCC('D','R','V','R') && id == 41) {
 
342
 
 
343
        } else if (type == FOURCC('D','R','V','R') && id == 41) {
312
344
                D(bug(" DRVR 41 found\n"));
313
345
                
314
 
                // gb-- [0x28E (ROM85)] contains 0x3fff that will be placed into a0
315
 
                // Seems to be caused by the AppleShare extension from MacOS 8.1 (3.7.4)
316
 
                // .AFPTranslator (DRVR addr 0x2372)
 
346
                // Don't access ROM85 as it it was a pointer to a ROM version number (8.0, 8.1)
317
347
                static const uint8 dat[] = {0x3a, 0x2e, 0x00, 0x0a, 0x55, 0x4f, 0x3e, 0xb8, 0x02, 0x8e, 0x30, 0x1f, 0x48, 0xc0, 0x24, 0x40, 0x20, 0x40};
318
348
                base = find_rsrc_data(p, size, dat, sizeof(dat));
319
349
                if (base) {
320
350
                        p16 = (uint16 *)(p + base + 4);
321
 
                        *p16++ = htons(0x3078);         // movea.w      ROM85,%a0
 
351
                        *p16++ = htons(0x303c);         // move.l       #ROM85,%d0
322
352
                        *p16++ = htons(0x028e);
323
 
                        *p16++ = htons(0xd1fc);         // adda.l       #RAMBaseMac,%a0
324
 
                        *p16++ = htons((RAMBaseMac >> 16) & 0xffff);
325
 
                        *p16++ = htons(RAMBaseMac & 0xffff);
326
 
                        *p16++ = htons(0x2448);         // movea.l      %a0,%a2
327
 
                        *p16++ = htons(M68K_NOP);
328
 
                        FlushCodeCache(p + base + 4, 14);
 
353
                        *p16++ = htons(M68K_NOP);
 
354
                        *p16++ = htons(M68K_NOP);
 
355
                        FlushCodeCache(p + base + 4, 8);
329
356
                        D(bug("  patch 1 applied\n"));
330
357
                }
331
358
        }
332
 
#endif
333
359
}