|
Author |
Message |
kasie
Member |
how to check from code, that system where is binary is running, is winuae, with 100% result ?
|
StingRay
Member |
I use the fact that UAE doesn't have 1oo% prefetch emulation. Since I don't want to spoon-feed you, I am not gonna post any code. :)
Basically, what you have to do is this:
You modify an instruction (SMC, woohoo \o/) and check the result directly after you modified it. On a real Amiga, you'd still have the ORIGINAL (i.e. unmodified) instruction due to the prefetch cache whereas on UAE you will have the NEW instruction, i.e. the one that you just "entered" with lovely SMC. :) That very trick was also used back in the day to baffle novice crackers. :D
|
Angry Retired Bastard
Member |
This, however, will only work for machines that HAVE a cache, so it could tell you that your amiga 500 is an emulator...
|
StingRay
Member |
Sorry to spoil your fun but even a500/68000 HAS prefetch cache! :D
|
winden
Member |
I recall UAE can be configured to emulate the next-word-prefetch when doing plain 68000, since it was needed for some very old games :)
|
StingRay
Member |
Hmm, yeah, I remember some "more compatible" setting or something. :) I'll do some tests. :D
|
StingRay
Member |
Ok, apparently the "more compatible" mode indeed emulates the prefetch. :)
(on 68000 ONLY!)
Just hacked a small .exe and checked it ($dff180 output rulez!). What's interesting though, if you disable "more compatible" and then enable it again on the fly, my prefetch cache trick works again. Guess that's another lovely bug in UAE. :D
|
kasie
Member |
hardcore .. why do not check just on uae.device is here or not ?
|
doom
Member |
uae.device would work, but it could be easily hidden if the UAE developers think it's a "compatibility issue"
UAE has really lousy FPU emulation (wrap instead of clamp, incompatible with 68k round-off modes and no extended precision floats).
UAE in JIT mode is way faster than an 060, so check instruction timing.
Check if UAE traps odd-aligned word fetches like a 68000 would.
Check sprite-sprite and sprite-playfield collisions (they're often disabled in UAE).
Check if you've got 8 MB of chipmem for some odd reason.
Check the raster/blanking behaviour. As far as I can tell, UAE triggers the vertical blanking interrupt at the beginning of the display window as opposed to the beginning of the frame. Can be detected with e.g. copper interrupts.
Generally just find stuff that doesn't work, figure out what goes wrong and duplicate it. And use redundant checks just in case they fix something.
|
krabob
Member |
> but it could be easily hidden if the UAE developers think it's a "compatibility issue" .
checking uae device is the right thing to do to check for UAE, just because it was done for this purpose. The does-it-behave-like-a-real-amiga-or not is tricky, and your forget that tons of other amiga OS also use 68k emulations, even on amiga classic. I mean, a MOS or AOS4 amiga1200 PPC user will throw a 68k executable and see "ohhh your are using UAE !!!"
on the other hand, there are absolutely no reason for a compatibility issue thing, has it check the presence of a device that wouldn't exist on classics.
When you want to know if there is TCPIP, check bsdsocket.library, if you want to know if there is cybergraphics, check cybergraphics.library, if you
want to know if you have FPU, ask the exec funcs, and if you want to know if you are under UAE check uae.device.
|
kasie
Member |
krabob, did you have email ?:) (want to talk with you a bit)
|
doom
Member |
> on the other hand, there are absolutely no reason for a compatibility issue thing, has it check the presence of a device that wouldn't exist on classics.
What I meant was, if too many executables appear that refuse to run on UAE and detect UAE by looking for uae.device, it would become a "compatibility issue", in that hiding uae.device would make those applications work.
With the amount of crap I suffered from UAE making Kilofix, I was really tempted to add some checks to break the demo on UAE with a message telling the user he's a twat. I made it "UAE compatible" instead by doing lots of unnatural things, especially with the FPU code and the raster/vblank code.
As for other emulators, well, you need to detect those too. If nothing else then in order to present a message to the user saying "This demo may not run properly on an emulator. If it doesn't work, and you feel you need to bug me about it, please kill yourself first."
|
|
|