Welcome, Guest. Please login or register.

Author Topic: How to detect if an emulator is being used ?  (Read 6622 times)

Description:

0 Members and 1 Guest are viewing this topic.

Offline fishy_fizTopic starter

  • Hero Member
  • *****
  • Join Date: Jan 2005
  • Posts: 1813
    • Show only replies by fishy_fiz
How to detect if an emulator is being used ?
« on: March 03, 2011, 04:29:09 AM »
The topic covers it I guess. Just wondering the best way to detect whether or not something is running on an emulator rather than real hardware ? (in code I mean, obviously eyes would suffice otherwise :))
Near as I can tell this is where I write something under the guise of being innocuous, but really its a pot shot at another persons/peoples choice of Amiga based systems. Unfortunately only I cant see how transparent and petty it makes me look.
 

Offline Franko

  • Hero Member
  • *****
  • Join Date: Jun 2010
  • Posts: 5707
    • Show only replies by Franko
Re: How to detect if an emulator is being used ?
« Reply #1 on: March 03, 2011, 04:34:43 AM »
Erm... that's kinda simple it will have the names Apple, Microsoft, Dell etc... somewhere on the machine... :)
 

Offline fishy_fizTopic starter

  • Hero Member
  • *****
  • Join Date: Jan 2005
  • Posts: 1813
    • Show only replies by fishy_fiz
Re: How to detect if an emulator is being used ?
« Reply #2 on: March 03, 2011, 04:56:29 AM »
Heh, even putting the aditional comment in brackets didnt stop the almost inevitable responses like this :)
Near as I can tell this is where I write something under the guise of being innocuous, but really its a pot shot at another persons/peoples choice of Amiga based systems. Unfortunately only I cant see how transparent and petty it makes me look.
 

Offline itix

  • Hero Member
  • *****
  • Join Date: Oct 2002
  • Posts: 2380
    • Show only replies by itix
Re: How to detect if an emulator is being used ?
« Reply #3 on: March 03, 2011, 04:59:26 AM »
There are certain (never used) special cases of 68k opcodes which are not working right in UAE.
My Amigas: A500, Mac Mini and PowerBook
 

Offline Franko

  • Hero Member
  • *****
  • Join Date: Jun 2010
  • Posts: 5707
    • Show only replies by Franko
Re: How to detect if an emulator is being used ?
« Reply #4 on: March 03, 2011, 05:02:47 AM »
Quote from: fishy_fiz;619171
Heh, even putting the aditional comment in brackets didnt stop the almost inevitable responses like this :)


Well it is a pretty daft question to be honest, a blind man & his dog would know if it was an emulator being used... :)

Of course you could try plugging in an accelerator card in the expansion port... what's that, no expansion port to plug me Amiga accelerator card into... must be a machine running an emulator then... :D
 

Offline vox

  • Hero Member
  • *****
  • Join Date: Feb 2011
  • Posts: 862
    • Show only replies by vox
    • http://anticusa.wordpress.com
Re: How to detect if an emulator is being used ?
« Reply #5 on: March 03, 2011, 06:55:50 AM »
Quote from: fishy_fiz;619160
The topic covers it I guess. Just wondering the best way to detect whether or not something is running on an emulator rather than real hardware ? (in code I mean, obviously eyes would suffice otherwise :))


You can`t, unless you remember have you started UAE or not :-)
Even FPGAs are also kind of emulated hardware, just in different way.

Well, why would you care? Performance would be higher if its 68k JIT emulated programe under OS4 or MOS, but then again now with JIT enabled UAE this might change to be not that significant difference.
Future Acube and MOS supporter, fi di good, nothing fi di unprofessionals. Learn it harder way! http://www.youtube.com/user/rasvoja and https://www.facebook.com/rasvoja
 

Offline motorollin

  • Hero Member
  • *****
  • Join Date: Nov 2005
  • Posts: 8669
    • Show only replies by motorollin
Re: How to detect if an emulator is being used ?
« Reply #6 on: March 03, 2011, 06:58:34 AM »
How about checking for the presence of uaescsi.device?

--
moto
Code: [Select]
10  IT\'S THE FINAL COUNTDOWN
20  FOR C = 1 TO 2
30     DA-NA-NAAAA-NAAAA DA-NA-NA-NA-NAAAA
40     DA-NA-NAAAA-NAAAA DA-NA-NA-NA-NA-NA-NAAAAA
50  NEXT C
60  NA-NA-NAAAA
70  NA-NA NA-NA-NA-NA-NAAAA NAAA-NAAAAAAAAAAA
80  GOTO 10
 

Offline Buzzfuzz

  • Sr. Member
  • ****
  • Join Date: Apr 2010
  • Posts: 377
    • Show only replies by Buzzfuzz
Re: How to detect if an emulator is being used ?
« Reply #7 on: March 03, 2011, 07:04:09 AM »
Quote from: fishy_fiz;619160
The topic covers it I guess. Just wondering the best way to detect whether or not something is running on an emulator rather than real hardware ? (in code I mean, obviously eyes would suffice otherwise :))

If you are referring to Sysinfo it will always show 7.09 Mhz, where as a true Amiga would show only it's true Mhz or in case of a 060 a '4' and nothing else.
« Last Edit: March 03, 2011, 01:28:10 PM by Buzzfuzz »
Wishlist: A3500, A2500UX
 

Offline psxphill

Re: How to detect if an emulator is being used ?
« Reply #8 on: March 03, 2011, 08:34:46 AM »
Quote from: fishy_fiz;619160
The topic covers it I guess. Just wondering the best way to detect whether or not something is running on an emulator rather than real hardware ? (in code I mean, obviously eyes would suffice otherwise :))

There isn't a reliable way to detect you are running in an emulator. You might be able to come up with a fingerprint analysis of incorrect behaviour, but that relies on you updating your code if an emulator manages to fix the behaviour.
 
It would also require you to do alot of testing on real hardware, as some of your tests might trigger a false positive.
 
I guess it depends on what you want to do & why.
 

Offline kvasir

  • Full Member
  • ***
  • Join Date: Aug 2004
  • Posts: 249
    • Show only replies by kvasir
    • http://watertonian.freeiz.com/1200brag/index.html
Re: How to detect if an emulator is being used ?
« Reply #9 on: March 03, 2011, 09:21:00 AM »
Quote from: fishy_fiz;619160
The topic covers it I guess. Just wondering the best way to detect whether or not something is running on an emulator rather than real hardware ? (in code I mean, obviously eyes would suffice otherwise :))


I remember using UAE-control, as an added program in UAE, which allows it to trigger a reset, change floppies (adf files), en/disable audio and joystick emulation. Perhaps figuring out how UAE-Control did that might help, via Enforcer or some kind of snooping tool? If its a physicall static memory address its sending info to (path of a windows/linux/whatever hosted ADF file), you might be able to "patch" that area of memory and see if it gets blocked or something. Or try to eject the disk, and monitor for errors when there's no electronic eject mechanism (Unless a physical Amiga floppy drive exists that did that, but I doubt it considering how annoying it was for Macs)

EDIT: Just tried it, looks like it uses line 1111 :D
« Last Edit: March 03, 2011, 09:36:24 AM by kvasir »
--
Amiga 1200T 68060 50MHZ 192MB Fast
 40GB IDE, 100MB Zip, CD/RW, DVD/Rom
 Mediator+ 4MBSVGA, Soundblaster, 100mbps Ethernet
 Subway USB+ endless list of gadgets :-D
My full specs
 

Offline Thomas

Re: How to detect if an emulator is being used ?
« Reply #10 on: March 03, 2011, 10:15:41 AM »
Quote
Just wondering the best way to detect whether or not something is running on an emulator rather than real hardware ?


The presence of one of WinUAE's expansions is surely a reliable indication that you are running on the emulator.

if (FindConfigDev (NULL,2011,-1) != NULL)
/* running on emulation */

However, the absence of UAE expansions does not necessarily mean that you are not running on emulation.

Quote
If its a physicall static memory address its sending info to


It *jumps* to a physical static memory address. That's the reason why you get unpredictable crashes, because you jump to unallocated memory.

Reading the memory address will give an enforcer hit, either, so it's not a reliable way to check for emulation.

Offline Piru

  • \' union select name,pwd--
  • Hero Member
  • *****
  • Join Date: Aug 2002
  • Posts: 6946
    • Show only replies by Piru
    • http://www.iki.fi/sintonen/
Re: How to detect if an emulator is being used ?
« Reply #11 on: March 03, 2011, 10:16:09 AM »
Quote from: itix;619173
There are certain (never used) special cases of 68k opcodes which are not working right in UAE.
Last I checked
Code: [Select]
move.l a7,-(a7)...works like on 68000 regardless on the CPU selection. So if you appeear to have a 68010+ CPU and the opcode stores the a7 value like on 68000 you can be sure that you're running under UAE.

I was reading the 68k manuals and noticed that 68000 and other CPUs varied on whether the original or predecremented a7 was stored in this case. I wasn't that surprised to learn that UAE always works like 68000 here... ;)
« Last Edit: March 03, 2011, 10:19:51 AM by Piru »
 

Offline fishy_fizTopic starter

  • Hero Member
  • *****
  • Join Date: Jan 2005
  • Posts: 1813
    • Show only replies by fishy_fiz
Re: How to detect if an emulator is being used ?
« Reply #12 on: March 03, 2011, 11:00:26 AM »
Thanks people. Should be enough to do what I was wanting now.
Near as I can tell this is where I write something under the guise of being innocuous, but really its a pot shot at another persons/peoples choice of Amiga based systems. Unfortunately only I cant see how transparent and petty it makes me look.
 

Offline Jope

Re: How to detect if an emulator is being used ?
« Reply #13 on: March 03, 2011, 11:09:45 AM »
Coding an emufuxxor? How quaint.

Why not just ask Toni directly, I'm sure he can give you some info as to what virtual devices / registers to check for.
 

Offline Wasagi

  • Newbie
  • *
  • Join Date: Sep 2010
  • Posts: 34
    • Show only replies by Wasagi
Re: How to detect if an emulator is being used ?
« Reply #14 on: March 03, 2011, 11:18:44 AM »
Quote from: Franko;619175
Well it is a pretty daft question to be honest, a blind man & his dog would know if it was an emulator being used... :)

Of course you could try plugging in an accelerator card in the expansion port... what's that, no expansion port to plug me Amiga accelerator card into... must be a machine running an emulator then... :D


I think you completely missed the point