Main > Driving & Racing Cabinets

Mame hacks that make driving games play better with mouse/spinner/360wheel

<< < (19/22) > >>

Yolo_Swaggins:
Hi Geecab, i hope you can figure it all out! I was playing around with swapping rom files from the compact hard drivin and race drivin' into the street drivin hardware on mame and can almost get it to work i was trying it out because the sound works much better on street drivin compared to hard drivin' and race drivin emulated hardware and the sound roms seem to be the exact same as race drivin' compact and race drivin' panorama share a lot of roms with street drivin' too! How do i run that script you made for the nvram files? I just do it in python again? Getting the steering as accurate as possible to the arcade would be really nice. I worked out what roms files contain the police car and the extra stock car track in street drivin', somebody good at decompiling and modding assembly code could maybe hack in the gear shifter to work as i find playing with the gears in the compact version is much more fun!

Yolo_Swaggins:
From reading the internal emails from Atari back when all these games were being made i can see that sometimes the test menu wasn't even completed before the game was. Maybe theres a chance that the cntrspn doesn't work because the code in the test menu isnt there to load it up? i kinda got this feeling from my discovery that the hacked ema wheel value i tried sending to street drivin specifically at the start of the game which would be much lower than the real value untill it average itself out over a few seconds makes the steering not work at all but if you reset the machine it will then work.  Makes me think that the game code dynamically adjusts that stuff based on the input range fed to it through mame? Airborne doesn't exhibit that behaviour and just seems to act like it's set in stone. It was 2 different teams that atari got to do street drivin and airborne and they would pick out the best one for release but it was already dated by the time all was said and done and they abandoned them both. It might explain why theres different steering behaviour between the 2 games.  Street drivin doesn't have any off the wheel being off center issues it was just the normal range of steering from the portminmax that the other games used was too big for street drivin i guess because the patcen isnt right? Maybe we need a dump of the original saved data from the street drivin and hard drivin's airborne to understand it more and make it work? What if the data was reset by somebody who got hold of the machines at a later date and this is what is causing it? I'm probobly wrong about it all but it's interesting trying to figure out whats going on and i hope you can fix it eventually it would be a really cool achievement and more people could get to test them out and see what might have been.

geecab:
Cool! That's interesting stuff Yolo!

Regarding those strange values I was reading in the hd68k_wr2_write() function, they definitely indicate steering wheel force feedback. The value indicates the amount of force that its trying to rotate the wheel (with either clockwise or anti clockwise)). I'll post more about this in a bit.

Regarding the script, yes its just python again. Create a file called, say, nvram_helper.py in the same directory as your mame.exe and copy that code into it. Run it without any parms and try one of the examples. Fingers crossed its work for you, not tested it on windows, only Linux so far.

:)

geecab:
Hi Yolo!

Thought I'd post my hack of the  hd68k_wr2_write() to read steering wheel force feedback. If you're interested, just replace the existing hd68k_wr2_write()  function with this one, and when holding the 'F' key in-game you can see the feedback trying to do its thing. Something that is pretty cool is watching the attract mode and viewing the force feedback, you can see how the game is trying to rotate the wheel when it hits the corners (You do need to enable the Steering During Attract Mode option for that though, I explain how to do that in the massive comment in the function).


--- Code: ---void harddriv_state::hd68k_wr2_write(offs_t offset, uint16_t data)
{
    /*
    Observations
    ============

    The 'data' repeats every 4 times this function is called.
    Offset always seems to be zero.
    Combining the 1st and 3rd byte of data gives you the steering
    wheel force feedback.

    When the game does not want to rotate the wheel in any direction,
    0xE000 is read.

    When the game wants the wheel to rotate clockwise, you see this:
        0xE000 increment to 0xE01F,
        then jumps to 0xE100 which increments to 0xE11F,
        then jumps to 0xE200 which increments to 0xE21F,
        then jumps to 0xE300 which increments to 0xE31F,
        etc...

    When the game wants the wheel to rotate anticlockwise, you see this:
        0xE000 jumps to 0xFF1F which decrements to 0xFF00,
        then jumps to 0xFE1F which decrements to 0xFE00,
        then jumps to 0xFD1F which decrements to 0xFD00,
        then jumps to 0xFC1F which decrements to 0xFC00,
        etc...

    Bits 0 to 7 never go above 32 (0x1f). Thus Bits 5 to 7 are unused.

    If bits 12 to 15 are 0xE this indicates the game is trying to turn
    the wheel clockwise. If they are 0xF, it is trying to turn the
    wheel anticlockwise.

    Shifting bits 8 to 11 right 3 places, gives you a value that
    increments/decrements logically.

    Testing
    =======

    In service mode, view the OPERATOR SCREENS and go to the 2nd page
    where there are 2 interesting options:
        Steering During Attract Mode
        Steering Wheel Force

    When Steering During Attract Mode is enabled, when you watch the
    attract mode, you'll see the the m_wheel_force change value as the
    game attempts to move the steering wheel while the car is moving around
    the track.

    When Steering Wheel Force is set to 'Very light' you'll see
    m_wheel_force in the range -70 to 70. When set to 'Stiff' you'll see
    m_wheel_force in the range -127 to 127.
    */

    static unsigned int static_count = 0;
    static uint8_t static_data[4];

    //printf("wr2 offset=%04X data=%04X\n", offset, data);

    //Store the data in this array (Must be a better way to do read this stuff...)
    static_data[static_count] = data;
    static_count++;
    if (static_count > 3)
    {
        uint16_t force_combined, force_shifted;
        int m_wheel_force;

        static_count = 0;

        //Combine the force (1st and 3rd byte)
        force_combined = ((static_data[2]<<8)&0xff00) | (static_data[0]&0x00ff);

        //Shift the force so that it logically increments/decrements
        force_shifted = (((force_combined)>>3)&0x01f0) | (force_combined&0xf01f);

        //Use the force
        if ((force_shifted&0xf000) == 0xe000)
        {
            m_wheel_force = int(force_shifted&0x0fff);          //Clockwise force (+ive number)
        }
        else
        {
            m_wheel_force = int(force_shifted&0x0fff) - 511;    //Anticlockwise force (-ive number)
        }


        if (machine().input().code_pressed(KEYCODE_F))
        {
            popmessage("wr2 wheel=0x%04X force=%d", m_hdc68k_last_wheel, m_wheel_force);
        }
    }
}

--- End code ---

:)

Yolo_Swaggins:

--- Quote from: geecab on May 08, 2024, 04:09:53 pm ---Hi Yolo!

Thought I'd post my hack of the  hd68k_wr2_write() to read steering wheel force feedback. If you're interested, just replace the existing hd68k_wr2_write()  function with this one, and when holding the 'F' key in-game you can see the feedback trying to do its thing. Something that is pretty cool is watching the attract mode and viewing the force feedback, you can see how the game is trying to rotate the wheel when it hits the corners (You do need to enable the Steering During Attract Mode option for that though, I explain how to do that in the massive comment in the function).


--- Code: ---void harddriv_state::hd68k_wr2_write(offs_t offset, uint16_t data)
{
    /*
    Observations
    ============

    The 'data' repeats every 4 times this function is called.
    Offset always seems to be zero.
    Combining the 1st and 3rd byte of data gives you the steering
    wheel force feedback.

    When the game does not want to rotate the wheel in any direction,
    0xE000 is read.

    When the game wants the wheel to rotate clockwise, you see this:
        0xE000 increment to 0xE01F,
        then jumps to 0xE100 which increments to 0xE11F,
        then jumps to 0xE200 which increments to 0xE21F,
        then jumps to 0xE300 which increments to 0xE31F,
        etc...

    When the game wants the wheel to rotate anticlockwise, you see this:
        0xE000 jumps to 0xFF1F which decrements to 0xFF00,
        then jumps to 0xFE1F which decrements to 0xFE00,
        then jumps to 0xFD1F which decrements to 0xFD00,
        then jumps to 0xFC1F which decrements to 0xFC00,
        etc...

    Bits 0 to 7 never go above 32 (0x1f). Thus Bits 5 to 7 are unused.

    If bits 12 to 15 are 0xE this indicates the game is trying to turn
    the wheel clockwise. If they are 0xF, it is trying to turn the
    wheel anticlockwise.

    Shifting bits 8 to 11 right 3 places, gives you a value that
    increments/decrements logically.

    Testing
    =======

    In service mode, view the OPERATOR SCREENS and go to the 2nd page
    where there are 2 interesting options:
        Steering During Attract Mode
        Steering Wheel Force

    When Steering During Attract Mode is enabled, when you watch the
    attract mode, you'll see the the m_wheel_force change value as the
    game attempts to move the steering wheel while the car is moving around
    the track.

    When Steering Wheel Force is set to 'Very light' you'll see
    m_wheel_force in the range -70 to 70. When set to 'Stiff' you'll see
    m_wheel_force in the range -127 to 127.
    */

    static unsigned int static_count = 0;
    static uint8_t static_data[4];

    //printf("wr2 offset=%04X data=%04X\n", offset, data);

    //Store the data in this array (Must be a better way to do read this stuff...)
    static_data[static_count] = data;
    static_count++;
    if (static_count > 3)
    {
        uint16_t force_combined, force_shifted;
        int m_wheel_force;

        static_count = 0;

        //Combine the force (1st and 3rd byte)
        force_combined = ((static_data[2]<<8)&0xff00) | (static_data[0]&0x00ff);

        //Shift the force so that it logically increments/decrements
        force_shifted = (((force_combined)>>3)&0x01f0) | (force_combined&0xf01f);

        //Use the force
        if ((force_shifted&0xf000) == 0xe000)
        {
            m_wheel_force = int(force_shifted&0x0fff);          //Clockwise force (+ive number)
        }
        else
        {
            m_wheel_force = int(force_shifted&0x0fff) - 511;    //Anticlockwise force (-ive number)
        }


        if (machine().input().code_pressed(KEYCODE_F))
        {
            popmessage("wr2 wheel=0x%04X force=%d", m_hdc68k_last_wheel, m_wheel_force);
        }
    }
}

--- End code ---

:)

--- End quote ---


Very cool and great work! If force feedback could become a native thing in mame for these games it would make life a lot easier as when i tried the force feedback plugin thats out there i never figured out how to get it to work for these games. Obviously i was doing something wrong on my end. I just found out that Race Drivin Panorama has the extra stock car track from Street Drivin' so i was thinking maybe i could swap the roms from that version into the Street Drivin' hardware driver in mame and get to play with the gear shifter and have the less glitchy audio and maybe run faster?  I almost had the Race Drivin' compact working on that hardware but some of the files were not compatible. I did manage to get the Race Drivin logo and credits to appear. I wish they never gave up on this game and made more of them with the same graphics style.

Navigation

[0] Message Index

[#] Next page

[*] Previous page

Go to full version