libretro / hatari

New rebasing of Hatari based on Mercurial upstream. Tries to be a shallow fork for easy upstreaming later on.
25 stars 41 forks source link

Android version not working, invalid TOS! #38

Open ghost opened 5 years ago

ghost commented 5 years ago

Hi, any help on getting this to work on Android ? I have the exact TOS.img that is required (according to libretro docs) in the system directory. I have created the required 'hatari.cfg' in the system directory and have this as the tos path -

szTosImageFileName = /storage/emulated/0/RetroArch/system/tos.img

When running a game all I get is -

Your TOS image seems not to be a valid file!
(TOS version 201, address $fc00)

I have tried different TOS.

gingerbeardman commented 5 years ago

The error message seems to indicate you have TOS 2.01 but libretro recommends US TOS 1.02.

TOS 2.x is not good for games. You really want an early TOS (recommended: 1.04), unless you're playing a known STE game in which case you want an STE TOS (recommended: 1.62)

http://www.avtandil.narod.ru/tose.html

Check your TOS against these hashes:

​tos102uk.img
CRC32:   3b5cd0c5
XXH:     aa615ab392288191
MD5:     b2a8570de2e850c5acf81cb80512d9f6

tos102us.img
CRC32:   d3c32283
XXH:     803961e44b1ae24a
MD5:     c1c57ce48e8ee4135885cee9e63a68a2

tos104uk.img
CRC32:   a50d1d43
XXH:     a41b7c12e9934272
MD5:     036c5ae4f885cbf62c9bed651c6c58a8

tos104us.img
CRC32:   90f4fbff
XXH:     3e8e164ad6c987e9
MD5:     736adb2dc835df4d323191fdc8926cc9

tos162uk.img
CRC32:   1c1a4eba
XXH:     4c8d250fd1edd699
MD5:     a4cfd3c7412002dd693f69a15d4d961c

tos162us.img
CRC32:   6372e5bd
XXH:     870036f1993e8d05
MD5:     febb00ba8784798293a7ae709a1dafcb
ghost commented 5 years ago

@gingerbeardman It seems that whatever TOS image I use (in the RetroArch/System dir) it gives the same error when trying to start a game. I'm not even using tos201 !? In the RetroArch core info it says my TOS is present ad correct with md5 c1c57ce...etc. But if I change the TOS image, RetroArch still gives the same md5 ??!! I don't even think it's looking at the hatari.cfg in the system directory.

Do you have Android that you could confirm this on ?

gingerbeardman commented 5 years ago

Sadly I do not.

I have created the required 'hatari.cfg' in the system directory and have this as the tos path -

Why did you do this? You do not have to create the CFG at all with RetroArch.

Are you sure the System directory is correct and configured correctly? (Do other emulators that rely on it work OK?)

gingerbeardman commented 5 years ago

I just played an ST game for the first time on a fresh setup (macOS):

  1. confirm RetroArch system directory (menu option: Settings > Directory > System/BIOS)
  2. outside of RetroArch app: put file tos.img (in my case UK 1.04) in the RetroArch system directory (for me that is ~/Documents/RetroArch/system)
  3. download the Hatari core (menu options: Main Menu > Load Core > Download Core)
  4. run game (menu option: Main menu > Load Content > browse to your game disk image)

At no point did I have to edit a CFG file.

gingerbeardman commented 5 years ago

Are you using RetroArch Hatari or Standalone Hatari?

ghost commented 5 years ago

RetroArch Hatari (on Android). This is what i've tried so far,

I deleted the hatari.cfg but RetroArch still gave the same error. That means it's not even using this file that the docs say to use.

I tried changing the tos to 104. The error changed to Invalid TOS etc. TOS version 401 !

I'll try a couple more TOS images.

I can confirm that it works fine on Windows.

ghost commented 5 years ago

I checked the md5 of the TOS's and they match what you posted above.

tos102uk gives error TOS image seems not to be a valid file! (TOS version 201 etc.) tos102us (Recommended by RetroArch) same error (TOS version 201) tos104uk same error (TOS version 401) tos162uk same error (TOS version 6201)

It seems no TOS's are valid on the Android version even though it works on Windows.

gingerbeardman commented 5 years ago

What system directory does RetroArch show in its Settings?

ghost commented 5 years ago

/storage/emulated/0/RetroArch/system/

Other cores are using the system directory fine (FUSE, MAME etc.). lr-Hatari is seeing the system directory because it's giving a different error with each TOS I tried as listed above.

gingerbeardman commented 5 years ago

What version of RetroArch and what version of Hatari core?

The fact that the TOS versions in the error message are printed backwards is potentially useful.

This is where the error is generated in the source code: https://github.com/libretro/hatari/blob/master/src/tos.c#L613-L633

But the formatting/wording is different to yours?

/* Now, look at start of image to find Version number and address */
TosVersion = SDL_SwapBE16(*(Uint16 *)&pTosFile[2]);
TosAddress = SDL_SwapBE32(*(Uint32 *)&pTosFile[8]);

/* Check for reasonable TOS version: */
if (TosVersion == 0x000 && TosSize == 16384)
{
    /* TOS 0.00 was a very early boot loader ROM which could only
     * execute a boot sector from floppy disk, which was used in
     * the very early STs before a full TOS was available in ROM.
     * It's not very useful nowadays, but we support it here, too,
     * just for fun. */
    TosAddress = 0xfc0000;
}
else if (TosVersion<0x100 || TosVersion>=0x500 || TosSize>1024*1024L
    || (!bRamTosImage && TosAddress!=0xe00000 && TosAddress!=0xfc0000))
{
    Log_AlertDlg(LOG_FATAL, "Your TOS image seems not to be a valid TOS ROM file!\n"
                 "(TOS version %x, address $%x)", TosVersion, TosAddress);
    return -2;
}
ghost commented 5 years ago

I'm using Android Kitkat.

My lr-Hatari version is 1.8 3fdaff4

gingerbeardman commented 5 years ago

@twinaphex @r-type what are your thoughts on this strange issue only affecting Android?

Could it be compiler- or endian-related?

AtariSoul commented 5 years ago

Hello @gingerbeardman I can confirm what @MajorWilly has said. I'm on Android 9 and using the same (latest) version of Hatari.

To add, if you press OK to the error, then press F11 to re-enable the mouse pointer. Then select ROM and I then changed it TOS to TOSUK104 by browsing to it. I then click the "reset machine" option and then click OK to reset. I now get the same error message but this time it says TOS 401 with the same hex address.

Also, the TOS version message seems to be back to front. Because i get 401 when using 1.04.

I hope this helps with the fix. Cheers

WeedyWeedSmoker commented 4 years ago

Hum... Just saw this issue, it's the same thing on iOS, I opened an issue report earlier but the 2 issues are completely related!

https://github.com/libretro/hatari/issues/35

Is it actually working on ANY kind of ARM processor out there? Raspberry? Anyone?

ajfarrell75 commented 4 years ago

It works on my raspberry pi, very same interface etc with excellent game compatibility.

I have same issue described on iOS, using retroarch which works for all 8 bit emulators, but problems with PUAE very slow.

Unfortunately can’t get any tos to work with retroarch on iOS, originally the error of Not loading the game would appear then by forcing the hatari core to read /system directory for bios/img it then loads partially and calls out incorrect img error. Very frustrating as it almost perfectly works 😂

Has anyone managed to get this working yet? Atari ST would be an excellent emulator to have on the fly!

Best, Anthony

diablodiab commented 3 years ago

This pull request should address it: https://github.com/libretro/hatari/pull/69