Hatari port [updated to V1.7.0]

hello ,

I’ve started a port of Hatari emulator .

it works at least on Linux , Android , PS3 , Wii . ( the basis) but it missing a way to use properly keyboard/mouse in android. (so use joypad for emulation )

[update 11/08/2013]

Bump to version 1.7.0

Should work on : linux32/64 , android , ps3 . break on wii for now.

You can found it here : https://github.com/libretro/libretro-hatari

Remember ,Everything not working well, It’s a debug release , so expect to more bug.

Default Control :

L2 Show/Hide statut R2
L Show/Hide vkbd . R Change Mouse speed 1 to 6 . (for gui and emu) SEL Toggle mouse/joy mode . STR Toggle num joy . A Fire/Mouse btn A / Valid key in vkbd B Mouse btn B X Switch Shift ON/OFF Y Hatari Gui

Knows Bugs:

- Joypad Mouse emulation is weird and a bit unusable in Hatari GUI. 

      This is really true for the Wii port. I've have to look at why.
       ( sorry but only way to change dsk/tos/system ect...  see bug bellow) 

- If you return to file-browser (L3+R3 / Home) and select & valid a new disk , PS3/Wii will FREEZE :(

- On Wii ,Sound freeze when you got to the Hatari Gui (be aware mute sound before go to the gui)

- Everything not working well, It's a debug release , so expect to more bug.

Outdated:

it works the basis but it failed when i go in GUI. (forever loop) i’ve try to use libco for solve this , but i think i do it bad because i’ve a core dump when i exit to the GUI . i’ve started look at dosbox code ,and then : basicly I setup libco in retro_init which launched emulator in emuthread. in the emulator core , when VLB i switch to mainthread. the retro_run do his job then swtich to emuthread. this part works . when in the GUI , i’ve setup a timer whitch switch to retro_run every frame. this works too , but when i exit GUI , it continue in emuthread then return to mainthread go 1 time in retro_run and then i got a coredump.

If someone have an idea … thanks in advance.

Hi,

nice to hear that you have been working on a libretro port. Without being able to look at the code though I can’t say anything about your issues.

Could you upload it to a public repository on Github so that we can see what you might be doing wrong?

lol it was a stupid wrong memset causing the issue :frowning:

otherwise i upload it to public repository on github for those who want to look at , but remember , not everything works well, It’s a debug release , so dont expect to much. and at this time it’s more like a big hack than a proper port .

Hi,

I’ve just fix the android compil , core seem to work ( you have to create a confdir for hatari in /mnt/sdcard for log/trace,hatari.cfg ,default rom loading ect…) .If you meet all these requirements , the dsk that you have selected will boot up .

but i’ve some questions regarding the android retroarch implementation : is there any softkeyboard overlay ? how are the mouse is handled?

Hi rtype, Long time no see :slight_smile:

I have been trying to test your core and have successfully compiled it for android but I am having trouble getting it to run. When I select the core and then a STX (Rick Dangerous (1989)(Core Design - Firebird)[!].stx) retroarch quits.

I have created a folder called “st” on my sd card and have placed a TOS image (Tos102.img UK Version) in there, re-named to tos.img.

Am I missing something?

Pete

STX is the pasti format for preserving copy protected images, is it not? Last time I looked into this, it was not yet reverse-enginereed for use with Hatari. The Steem emulator requires the additional pasti.dll for it to use it (on Windows at least).

Thanks for the reply :slight_smile: I’m new to ST emulation.

What format images do you recommend?

Look for plain ST disks. MSA probably also works, I haven’t tried it yet with Hatari.

I’ve tried a couple of different TOS images and a few .ST files but I am still having the same problem.

Hopefully R-Type can help :slight_smile:

Hi ,

Yes pete , long time :slight_smile: , long time i touch my ps3 also !

For your issue , yes only ST or MSA , have to rename your tos to “rom” and put in /mnt/sdcard (or put a hatari.cfg with correct values in this dir) but now i’m not sure i commit the good version ( i am @work for now, i can’t check).

I’ve test with many game , they load fine ( but for the most i block to the intro screen or workbensh because no mouse or keyboard ). the only one i’ve play is metrocross since this one can be run with the joystick (overlay).

Let me know if it works.

Thanks Rtype.

I’ll do some more testing and will let you know how I get on :slight_smile:

Ok ,

i’ve just re-compile harari from github and not working until i put a “hatari.cfg” in “/mnt/sdcard/st/” (something wrong with configuration and path).

i put my hatari.cfg for those want testing. (adjust to your needs)


shell@android:/mnt/sdcard/st # cat hatari.cfg                                  
[Floppy]
bAutoInsertDiskB = TRUE
nWriteProtection = 0
szDiskAFileName =
szDiskBFileName =
szDiskImageDirectory = /mnt/sdcard/st
szDiskAZipPath =
szDiskBZipPath =

[HardDisk]
bBootFromHardDisk = FALSE
bUseHardDiskDirectory = FALSE
szHardDiskDirectory = /mnt/sdcard/st/hdisk
bUseHardDiskImage = FALSE
szHardDiskImage = /mnt/sdcard/st/hdisk
bUseIdeHardDiskImage = FALSE
szIdeHardDiskImage = /mnt/sdcard/st/hdisk

[Memory]
bAutoSave = FALSE
nMemorySize = 1
szAutoSaveFileName = /mnt/sdcard/st/auto.sav
szMemoryCaptureFileName = /mnt/sdcard/st/hatari.sav

[Midi]
bEnableMidi = FALSE
sMidiInFileName = /dev/snd/midiC1D0
sMidiOutFileName = /dev/snd/midiC1D0

[Printer]
bEnablePrinting = FALSE
bPrintToFile = TRUE
szPrintToFileName = /mnt/sdcard/st/hatari-printer.txt

[ROM]
szCartridgeImageFileName =
szTosImageFileName = /mnt/sdcard/st/tos/tos102fr.img

[RS232]
bEnableRS232 = FALSE
szOutFileName = /dev/modem
szInFileName = /dev/modem

[Screen]
bAllowOverscan = FALSE
bFullScreen = TRUE
bUseExtVdiResolutions = FALSE
nForceBpp = 16
nSpec512Threshold = 16
nFrameSkips = 0
nMonitorType = 1
nVdiColors = 0
nVdiWidth = 640
nVdiHeight = 480
bShowStatusbar = FALSE
bShowDriveLed = FALSE
bAspectCorrect = TRUE
nMaxWidth = 640
nMaxHeight = 480
nWindowBorderPixelsTop = 0
nWindowBorderPixelsLeft = 48
nWindowBorderPixelsRight = 48
nWindowBorderPixelsBottom = 40
nFullScreenBorderPixelsTop = 0
nFullScreenBorderPixelsLeft = 32
nFullScreenBorderPixelsRight = 32
nFullScreenBorderPixelsBottom = 40

[Sound]
bEnableSound = TRUE
szYMCaptureFileName = /mnt/sdcard/st/hatari.wav
nPlaybackFreq = 44100

[System]
bBlitter = FALSE
bCompatibleCpu = FALSE
bFastForward = FALSE
bPatchTimerD = TRUE
bRealTimeClock = TRUE
nCpuFreq = 8
nCpuLevel = 0
nDSPType = 0
nMachineType = 0

[Log]
sLogFileName = /mnt/sdcard/st/1log.txt
sTraceFileName = /mnt/sdcard/st/1trace.txt
nTextLogLevel = 1
nAlertDlgLogLevel = 1
bConfirmQuit = FALSE

[Debugger]
nNumberBase = 10
nDisasmLines = 8
nMemdumpLines = 8


Yep that got it working Rtype :slight_smile:

Now to find some images without cracktros :smiley:

glad if it works

:slight_smile: not simple as we can think , as the cracktros were fashionable in the middle of 80s !

by the way , you can bybass some of these (cracktos) by assign some ST keys to the RETRO_DEVICE_JOYPAD (except direction & BTN_A) .

you need to modify update_input() in libretro-hatari.c example if you use SNES overlay, you can do something like this to assign BNT_B to Return ST Key : (look at SDLKeyToSTScanCode to know corresponding keys)


static mbt[16]={0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0};

if ( (input_state_cb(0, RETRO_DEVICE_JOYPAD, 0, RETRO_DEVICE_ID_JOYPAD_B)) && mbt[0]==0 ){
    mbt[0]=1;
    IKBD_PressSTKey(0x1C,1); //Return key press
}
else if ( mbt[0]==1 ){
    mbt[0]=0;
    IKBD_PressSTKey(0x1C,0); //Return key release
}

I 'll had some of these short-cuts when I’ll have time , until i found a way to use soft keyboard.

[quote=“7rtype”] glad if it works

:slight_smile: not simple as we can think , as the cracktros were fashionable in the middle of 80s ![/quote]

I’ve just acquired the ST TOSEC, I’m sure there’s some in there :smiley:

by the way , you can bybass some of these (cracktos) by assign some ST keys to the RETRO_DEVICE_JOYPAD (except direction & BTN_A) .

you need to modify update_input() in libretro-hatari.c example if you use SNES overlay, you can do something like this to assign BNT_B to Return ST Key : (look at SDLKeyToSTScanCode to know corresponding keys)

static mbt[16]={0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0};

if ( (input_state_cb(0, RETRO_DEVICE_JOYPAD, 0, RETRO_DEVICE_ID_JOYPAD_B)) && mbt[0]==0 ){ mbt[0]=1; IKBD_PressSTKey(0x1C,1); //Return key press } else if ( mbt[0]==1 ){ mbt[0]=0; IKBD_PressSTKey(0x1C,0); //Return key release }

I 'll had some of these short-cuts when I’ll have time , until i found a way to use soft keyboard.

I’m using a DualShock 3 personally. I’ll have a look at this tomorrow :slight_smile:

Lol shame on me , I was not aware that there ! always playing with my atari st goodset

I had forgotten that I had a DS3 too :slight_smile: I tested the installation with my phone and not my tablet.

I just tested by assigning several useful buttons as in the previous example. eg: RETRO_DEVICE_ID_JOYPAD_X to STKey_ Space (0x39) RETRO_DEVICE_ID_JOYPAD_L2 to STKey_ N (0x31)

and it seems to work well with my DS3 on my tablet.

What part of the file do I have to edit? I’m a coding noob :slight_smile:

I did try, but it error-ed out while compiling :frowning:

so just replace in libretro-hatari.c the void update_input(void) func by this one for example :


static void update_input(void)
{
       input_poll_cb();

     MXjoy0=0;

        if (input_state_cb(0, RETRO_DEVICE_KEYBOARD, 0, RETROK_F11)){pauseg=1;}

    #define HACK_PUK 1
    #ifdef HACK_PUK
    //   ST         RET  SPC  ESC  F1   UP   DWN  LFT  RGT  BTN  1    Y    N    J    S    2    3
    //   RETRO      B    Y    SLT  STA  UP   DWN  LEFT RGT  A    X    L    R    L2   R2   L3   R3
     static int vbt[16]={0x1C,0x39,0x01,0x3B,0x01,0x02,0x04,0x08,0x80,0x6D,0x15,0x31,0x24,0x1F,0x6E,0x6F};
    static int mbt[16]={0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0};
    int i;

    for(i=0;i<16;i++){

        if(i>3 && i<9){

            if( input_state_cb(0, RETRO_DEVICE_JOYPAD, 0, i) )MXjoy0 |= vbt[i]; // Joy press
        }
        else {

            if ( input_state_cb(0, RETRO_DEVICE_JOYPAD, 0, i) && mbt[i]==0 ){

                    mbt[i]=1;
                IKBD_PressSTKey(vbt[i],1); // key press
            }
            else if ( mbt[i]==1 ){

                   mbt[i]=0;
                IKBD_PressSTKey(vbt[i],0); // key release
            }

        }

    }

    #else

        if (input_state_cb(0, RETRO_DEVICE_JOYPAD, 0, RETRO_DEVICE_ID_JOYPAD_RIGHT))MXjoy0 |= 0x08;

        if (input_state_cb(0, RETRO_DEVICE_JOYPAD, 0, RETRO_DEVICE_ID_JOYPAD_LEFT))MXjoy0 |= 0x04;

        if (input_state_cb(0, RETRO_DEVICE_JOYPAD, 0, RETRO_DEVICE_ID_JOYPAD_DOWN))MXjoy0 |= 0x02;

        if (input_state_cb(0, RETRO_DEVICE_JOYPAD, 0, RETRO_DEVICE_ID_JOYPAD_UP))MXjoy0 |= 0x01;

        if (input_state_cb(0, RETRO_DEVICE_JOYPAD, 0, RETRO_DEVICE_ID_JOYPAD_A))MXjoy0 |= 0x80;

    #endif

       int16_t mouse_x = input_state_cb(0, RETRO_DEVICE_MOUSE, 0, RETRO_DEVICE_ID_MOUSE_X);
       int16_t mouse_y = input_state_cb(0, RETRO_DEVICE_MOUSE, 0, RETRO_DEVICE_ID_MOUSE_Y);
       bool mouse_l    = input_state_cb(0, RETRO_DEVICE_MOUSE, 0, RETRO_DEVICE_ID_MOUSE_LEFT);
       bool mouse_r    = input_state_cb(0, RETRO_DEVICE_MOUSE, 0, RETRO_DEVICE_ID_MOUSE_RIGHT);

       static int mbL=0,mbR=0;
    
    if(mbL==0 && mouse_l){
        mbL=1;
        Keyboard.bLButtonDown |= BUTTON_MOUSE;
    }
    else if(mbL==1 && !mouse_l) {

         Keyboard.bLButtonDown &= ~BUTTON_MOUSE;
                mbL=0;
    }

    if(mbR==0 && mouse_r){
        mbR=1;
        Keyboard.bRButtonDown |= BUTTON_MOUSE;
    }
    else if(mbR==1 && !mouse_r) {

         Keyboard.bRButtonDown &= ~BUTTON_MOUSE;
                mbR=0;
    }

      fmousex=mouse_x;
      fmousey=mouse_y;

      Main_HandleMouseMotion();

}

Thanks again Rtype :slight_smile: That’s allowed a lot more games to work.

i’ve created a test branch on github with a hack to use joypad to simulate keyb/mouse . it’s not ideal but can help to start some games. (btw not tested yet lol).

basically :

L2 for move to key left R2for move to key right L show/hide key R valid a key SEL toggle mouse/joy mode STR toggle num joy (not implant for now) A fire in joy mode /mouse btna in mouse mode B mouse btnb in mouse mode

it’s a debug feature .

waiting to see how to manage the keyboard and mouse on android retroarch.

but apart from changing the code retroarch I’m not sure. by adding the code in key str_to_bind [] on the limit can surely make a overlay keyboard cleaner but would manage the SoftKeyboard android directly. and the problem remains for the mouse (physics is managed in the UI but not in the emu, and used for overlay FingerTouch not easy to implement without any remodify.

in short no simple