Main Restorations Software Audio/Jukebox/MP3 Everything Else Buy/Sell/Trade
Project Announcements Monitor/Video GroovyMAME Merit/JVL Touchscreen Meet Up Retail Vendors
Driving & Racing Woodworking Software Support Forums Consoles Project Arcade Reviews
Automated Projects Artwork Frontend Support Forums Pinball Forum Discussion Old Boards
Raspberry Pi & Dev Board controls.dat Linux Miscellaneous Arcade Wiki Discussion Old Archives
Lightguns Arcade1Up Try the site in https mode Site News

Unread posts | New Replies | Recent posts | Rules | Chatroom | Wiki | File Repository | RSS | Submit news

  

Author Topic: Patching Daytona in m2emulator  (Read 37746 times)

0 Members and 1 Guest are viewing this topic.

SailorSat

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 1238
  • Last login:Today at 06:58:15 pm
    • For Amusement Only e.V.
Patching Daytona in m2emulator
« on: May 02, 2014, 07:26:44 am »
Hi folks.

I'm working on rom-patches for daytona to enable some of the "hidden" stuff missing in m2emulator.

So far I have two jobs I'm working on.
  • enable the "special type" inputs in dayontas/se - DONE
  • remap the lamp outputs for daytona - DONE


daytonas.lua
Code: [Select]
require("model2"); -- Import model2 machine globals

function Init()
Patch_SpecialInputs();
Patch_LampOutputs();
end

function Patch_SpecialInputs()
-- first, disable old read
Romset_PatchDWord(0, 0x1E504, 0x5CA01E00); -- MOV g4,0x00 (NOOP?)

-- now jump to our patched read
Romset_PatchDWord(0, 0x1E508, 0x090219F8); -- CALL 0x0003FF00

-- read io port
Romset_PatchDWord(0, 0x3FF00, 0x80A03000);
Romset_PatchDWord(0, 0x3FF04, 0x01C00012); -- LDOB g4,0x01C00012

-- read patched mask
Romset_PatchDWord(0, 0x3FF08, 0x80B83000);
Romset_PatchDWord(0, 0x3FF0C, 0x00500820); -- LDOB g7,0x00500820

-- and em
Romset_PatchDWord(0, 0x3FF10, 0x58A50097); -- AND g4,g4,g7

-- restore old mask
Romset_PatchDWord(0, 0x3FF14, 0x8CB800FF); -- LDA g7,0xff

-- return
Romset_PatchDWord(0, 0x3FF18, 0x0A000000);  -- RET
end

function Patch_LampOutputs()
-- reroute 0x01C0001E to 0x00500824
for offset = 0x00000000, 0x0003FFFF, 4 do
if Romset_ReadDWord(0, offset) == 0x01C0001E then
Romset_PatchDWord(0, offset, 0x00500824);
local opcode = offset - 1;
if Romset_ReadByte(0, opcode) == 0x80 then
Romset_PatchByte(0, opcode, 0x90) -- replace LDOB with LD
end
if Romset_ReadByte(0, opcode) == 0x82 then
Romset_PatchByte(0, opcode, 0x92) -- replace STOB with ST
end
end
end
end

function PostDraw()
if I960_ReadByte(RAMBASE + 0x00000820) == 0x00 then
I960_WriteByte(RAMBASE + 0x00000820, 0xFF);
end

-- 0xFF = normal
-- 0xFD = force beginner
-- 0xFB = force advanced
-- 0xF9 = force expert

-- 0xF7 = emergency/remote start

-- 0x7F = ex.start; as long as hold down, the track selection stays on (even after the 15 second countdown)

-- 0x3E = DIK_F4
-- 0x3F = DIK_F5
local data = 0xFF;
data = XOR(SHL(Input_IsKeyPressed(0x3E), 0x07), data); -- F4 for ex.start
data = XOR(SHL(Input_IsKeyPressed(0x3F), 0x03), data);  -- F5 for emergency/remote start
I960_WriteByte(RAMBASE + 0x00000820, data);

Video_DrawText(0,0,HEX8(I960_ReadByte(0x00500824)),0xFFFFFF);
end



"special type" inputs
the special type inputs are used on the control tower. i traced the lines in the shematics / manual of the special type daytona.
the tower is seen at the beginning of
there seems to be some additional logic in the control tower to trigger the ex.start and emergency lines.
- the ex.start signal keeps the track selection up as long as hold.
- the emergency/remote start signal causes the game to start (if in attract mode), and forces the hydraulic seats to stop moving (if in game)
- the track selection signals (2 lines) can force selection of a specific track.



lamp outputs
the lamp outputs are triggered by reads/writes at 0x01C0001E. i hooked up the control register in mame and have nice outputs.
as m2em is closed source, i tried to patch all reads/writes there to some area in the RAM area, so we can access the data.
the original code uses LDOB/STOB opcodes which for some reason don't seem to work.
I've replaced them with LD/ST and now it works.
« Last Edit: June 27, 2014, 02:11:41 am by SailorSat »
I do all that stuff even without a Joystick ;)
Soft-15kHz, cabMAME, For Amusement Only e.V.


Howard_Casto

  • Idiot Police
  • Trade Count: (+1)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 19427
  • Last login:Yesterday at 12:48:28 pm
  • Your Post's Soul is MINE!!! .......Again??
    • The Dragon King
Re: Patching Daytona in m2emulator
« Reply #1 on: May 02, 2014, 10:58:46 am »
AFAICT, the output pcb that ran the outputs in Daytona is not emulated in model2 emulator.  Ramjet, Outrun and I have already created "fake" outputs via reading some other memory locations.  I have a few of them hooked up in troubleshooter 2 which will send them directly to the latest version of mamehooker.  The ini file in memcfg is fairly self-explanatory if you know what you are doing so if you want, you can add the rest from ramjet's borderless app and you are done.  No patching necessary.  ;)

twistedsymphony

  • Trade Count: (+1)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 584
  • Last login:February 03, 2024, 11:13:51 pm
  • Play stupid games... win stupid prizes.
    • solid-orange.com
    • CollectorsEdition.org
Re: Patching Daytona in m2emulator
« Reply #2 on: May 02, 2014, 11:00:06 am »
Howard, if M2E doesn't have AFAICT emulated then how was it possible to get lamp output in test mode?

If needed for reference here's a good video demoing the lights for the non-race-leader lamps: http://youtu.be/a101qgl8Ncs?t=1m4s
« Last Edit: May 02, 2014, 11:03:54 am by twistedsymphony »

Malenko

  • KNEEL BEFORE ZODlenko!
  • Trade Count: (+58)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 14019
  • Last login:July 02, 2025, 09:03:11 pm
  • Have you played with my GingerBalls?
    • forum.arcadecontrols.com/index.php/topic,142404.msg1475162.html
Re: Patching Daytona in m2emulator
« Reply #3 on: May 02, 2014, 11:09:22 am »
Howard, if M2E doesn't have AFAICT emulated then how was it possible to get lamp output in test mode?

Thought AFAICT meant "As Far As I Can Tell"?
If you're replying to a troll you are part of the problem.
I also need to follow this advice. Ignore or report, don't reply.

Howard_Casto

  • Idiot Police
  • Trade Count: (+1)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 19427
  • Last login:Yesterday at 12:48:28 pm
  • Your Post's Soul is MINE!!! .......Again??
    • The Dragon King
Re: Patching Daytona in m2emulator
« Reply #4 on: May 02, 2014, 11:18:47 am »
It does.  ;)

A few sega games seem to do this, I've seen it in mame before.  Test mode will often send a totally different range of values to the output memory region than the game itself.  As most of these games don't have the output hardware emulated either, I can only assume that the boards either had some sort of two-way communication, or some sort of watchdog is set periodically that's ignored in the test menu. 

(It's been a few years since I've messed with this so excuse me if the info is a bit inaccurate, I'm going completely on memory.  )

The thing is earlier Sega games just don't care, so I was able to hook up a lot of outputs anyway.  For example I've got a driver lying around somewhere that gives you force-feedback on Afterburner II, but it often just stops after stage 1.  I think this is due to a memory byte that's supposed to be flipped by the hardware not being present.  I'm by no means an expert on Sega hardware though, I just play around with it until I figure it out. 

Also one of the racing games in mame did something similar. (Can't remember which, it was a early 90's 2d racer)  In the test menu it gave crazy big values for the outputs in the test menu, but more standard "sega style" bit masking in-game.  I did a work-around by simply checking for either value, but in all honesty this isn't proper procedure. 

If whatever byte that needs to be set can be found, that's great, but I'm doubtful there is enough code in there to do it.  I looked for about a month and god knows how long RamJet looked prior to me.

twistedsymphony

  • Trade Count: (+1)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 584
  • Last login:February 03, 2024, 11:13:51 pm
  • Play stupid games... win stupid prizes.
    • solid-orange.com
    • CollectorsEdition.org
Re: Patching Daytona in m2emulator
« Reply #5 on: May 02, 2014, 11:31:57 am »
Thought AFAICT meant "As Far As I Can Tell"?

lol... of course it does, I guess I'm just an idiot this morning; when I read it I thought that's what you were calling the output board :laugh2:

Thanks for the insight, Howard  :cheers: that actually makes a lot of sense.

Jitterdoomer

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 58
  • Last login:February 26, 2023, 06:37:11 am
  • I want to build my own arcade controls!
    • Personal Twitter Page
Re: Patching Daytona in m2emulator
« Reply #6 on: May 02, 2014, 12:34:41 pm »
The special tower buttons require 8 computers to be connected to the LAN like the one in the video, am I correct? I've seen this similar feature in Outrun 2 SP SDX for Lindbergh where it controls the player and the motion cabinet.
« Last Edit: May 02, 2014, 12:37:33 pm by Jitterdoomer »
For amusement only.

Howard_Casto

  • Idiot Police
  • Trade Count: (+1)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 19427
  • Last login:Yesterday at 12:48:28 pm
  • Your Post's Soul is MINE!!! .......Again??
    • The Dragon King
Re: Patching Daytona in m2emulator
« Reply #7 on: May 02, 2014, 12:46:17 pm »
Yeah, although I'm fairly certain that it also works in single player mode if you are in first place.  That's how ramjet faked it btw... check the leader pos... if you are in first blink the lamp.  Sat's multiplayer hacks could do something similar..... check the car position for each car, the car with the lowest value is the race leader... blink their lamp.

SegaOutrun

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 406
  • Last login:March 28, 2019, 03:02:05 am
  • Brakes are overrated
Re: Patching Daytona in m2emulator
« Reply #8 on: May 02, 2014, 01:43:31 pm »
the nearby dave and busters has an 8 player special edition. I had no idea they made daytona cabs with motion control seats. Being toss around in the seat threw me off my game and i was lucky i didnt tell the people i was with " i play this game all time at home all the time" since i did poorly. lol

Jitterdoomer

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 58
  • Last login:February 26, 2023, 06:37:11 am
  • I want to build my own arcade controls!
    • Personal Twitter Page
Re: Patching Daytona in m2emulator
« Reply #9 on: May 02, 2014, 05:38:16 pm »
The Special Type inputs are going to be based on this?
For amusement only.

SailorSat

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 1238
  • Last login:Today at 06:58:15 pm
    • For Amusement Only e.V.
Re: Patching Daytona in m2emulator
« Reply #10 on: May 02, 2014, 06:16:36 pm »
AFAICT, the output pcb that ran the outputs in Daytona is not emulated in model2 emulator.  Ramjet, Outrun and I have already created "fake" outputs via reading some other memory locations.  I have a few of them hooked up in troubleshooter 2 which will send them directly to the latest version of mamehooker.  The ini file in memcfg is fairly self-explanatory if you know what you are doing so if you want, you can add the rest from ramjet's borderless app and you are done.  No patching necessary.  ;)

The lamps (and coin chutes) are handled by two 7 channel darlington drivers; no cpu doing anything. Also, the IO pcb (which contains those darlingtons) is exactly the same as on Model1 hardware.
The only difference between Virtua Racing / Daytona and the "other" games is the fact that VR and Daytona read the current lamp state before trying to update it. WingWar for example does not, and simply writes there.
For that reason lamp outputs in Virtua Racing didn't work for a long time.

I know the ramjetvr script, however I'd prefer the real thing :)



The Special Type inputs are going to be based on this?
Yup. currently looks something like this.



A few sega games seem to do this, I've seen it in mame before.  Test mode will often send a totally different range of values to the output memory region than the game itself.  As most of these games don't have the output hardware emulated either, I can only assume that the boards either had some sort of two-way communication, or some sort of watchdog is set periodically that's ignored in the test menu.

Actually it is very simple once you figured out how it works ;)
I recently did with Virtua Racing / Virtua Formula and all the custom ---steaming pile of meadow muffin--- (airbag control, hydraulic cabinet etc.).
Now I can feed the game with dip switches on the addon hardware, feed data of the VR pot etc.

Still a long way to go though. Getting the "wheel" feedback working simple enough.

Just as example:
VR (as does daytona, like said, same IO board) sends various commands to 0xC00011 and reads from 0xC0000A.
Now for the catch... there is a "feature select" command that controls what can be read from 0xC0000A.

// vr drive bd commands
// 0x10 = spring (do nothing)
// 0x2x = clutch (0x20 - 0x2f)
// 0x3x = centering (0x30 - 0x3f)
// 0x4x = uncentering (0x40 - 0x4f)
// 0x5x = roll left (0x50 - 0x5f)
// 0x6x = roll right (0x60 - 0x6f)
// 0x8x = feature select - 81 = drive board dip bank 1, 82 = drive board dip bank 2, 83 = drive board wheel pot etc.

the "deluxe" VR has 2 pages of airbag registers (and control).
the virtua formula has 3 pages of hydraulic control.

back to topic. I just want to redirect the lamp control to some other memory location, as the m2emulator masks the "real" location. should not be too complicated :)
I do all that stuff even without a Joystick ;)
Soft-15kHz, cabMAME, For Amusement Only e.V.


Howard_Casto

  • Idiot Police
  • Trade Count: (+1)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 19427
  • Last login:Yesterday at 12:48:28 pm
  • Your Post's Soul is MINE!!! .......Again??
    • The Dragon King
Re: Patching Daytona in m2emulator
« Reply #11 on: May 02, 2014, 07:00:23 pm »
Not to argue semantics or anything, but if a feature select byte has to be written and it currently isn't then what I said was true... the game requires two way communication and a portion of the output hardware isn't emulated, namely the write ability.  Yet you responded as if I'm incorrect. 

I apologize if this comes off as rude, I've had about 2 hours of sleep in the past day or so. 

Regardless I'm glad you figured it out.  By your explanation rail chase, Jurassic Park and a couple other problem games are probably doing the same thing.  I might look into it when I get time.   

SailorSat

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 1238
  • Last login:Today at 06:58:15 pm
    • For Amusement Only e.V.
Re: Patching Daytona in m2emulator
« Reply #12 on: May 03, 2014, 04:00:56 am »
I apologize if this comes off as rude, I've had about 2 hours of sleep in the past day or so. 
No problem, know that problem well ^^

Regardless I'm glad you figured it out.  By your explanation rail chase, Jurassic Park and a couple other problem games are probably doing the same thing.  I might look into it when I get time.

Maybe. Poking around in various bits'n'bytes and trying to get it certainly feels like "watching the matrix" ^^ :)
I do all that stuff even without a Joystick ;)
Soft-15kHz, cabMAME, For Amusement Only e.V.


Howard_Casto

  • Idiot Police
  • Trade Count: (+1)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 19427
  • Last login:Yesterday at 12:48:28 pm
  • Your Post's Soul is MINE!!! .......Again??
    • The Dragon King
Re: Patching Daytona in m2emulator
« Reply #13 on: May 03, 2014, 04:19:44 am »
Heh tell me about it. 

I still have nightmares about Terminator 2 and Operation Wolf 3.  The damn things strobed a set of values so fast and for some reason if you tried to step through a frame at a time, the data either froze or fell off.... I had to write a logger in mamehooker for those.  I'm still not 100% certain op Wolf 3 is 100% correct, but thankfully it's Operation Wolf 3 so absolutely nobody will ever notice as nobody will ever play it.  ;)

I'm hoping I can find the X,Y,Z values of the car in Outrun 2006 as well.  The values are in vectors and seem to be in the same general area as the camera values, so it's like looking for a needle in a pile of needles.  I think I might be able to get some help on that one though. 

If I can get that working and you can get the stuff working in Daytona it almost might be worth it to make a motion sim cab. 

Jitterdoomer

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 58
  • Last login:February 26, 2023, 06:37:11 am
  • I want to build my own arcade controls!
    • Personal Twitter Page
Re: Patching Daytona in m2emulator
« Reply #14 on: May 03, 2014, 04:51:47 am »
Hopefully someone will find a code for the getting hit lamp for Terminator 2, I don't remember Operation Wolf 3 has a lamp where you get hit by an enemy or something. On an off-topic note, have you played Real Puncher so that you can poke around the code for the camera feature? I just want to take a snapshot of Bieber and put it into the game :P
« Last Edit: May 03, 2014, 04:53:38 am by Jitterdoomer »
For amusement only.

Howard_Casto

  • Idiot Police
  • Trade Count: (+1)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 19427
  • Last login:Yesterday at 12:48:28 pm
  • Your Post's Soul is MINE!!! .......Again??
    • The Dragon King
Re: Patching Daytona in m2emulator
« Reply #15 on: May 03, 2014, 05:26:09 am »
The hit lamps are already hooked up in T2... I did it myself.  ;)

I hooked up the gun recoils, the red and green indicator leds on the guns and all the flash targets (hit lights) that light up the bezel.  According to the manual that's all there is.

Jitterdoomer

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 58
  • Last login:February 26, 2023, 06:37:11 am
  • I want to build my own arcade controls!
    • Personal Twitter Page
Re: Patching Daytona in m2emulator
« Reply #16 on: May 03, 2014, 05:38:00 am »
Does the Red and Green LED on the gun represents your gunpower? Green is where your ammo is full while red is empty, you have to pick up the Extended Cooler or a Clip to reload and it gets back to green.
For amusement only.

Howard_Casto

  • Idiot Police
  • Trade Count: (+1)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 19427
  • Last login:Yesterday at 12:48:28 pm
  • Your Post's Soul is MINE!!! .......Again??
    • The Dragon King
Re: Patching Daytona in m2emulator
« Reply #17 on: May 03, 2014, 05:53:41 am »
No, the green led means you have locked onto a target and you can fire at will.  The red led means the opposite... an enemy on the screen has locked onto you and they are firing.

We probably need to quit hijacking poor old SailorSat's thread though.  ;)

Jitterdoomer

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 58
  • Last login:February 26, 2023, 06:37:11 am
  • I want to build my own arcade controls!
    • Personal Twitter Page
Re: Patching Daytona in m2emulator
« Reply #18 on: May 04, 2014, 01:25:14 am »
Alright Howard, so Sailorsat, do I have to get another computer to control the players and the track selection?
For amusement only.

SailorSat

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 1238
  • Last login:Today at 06:58:15 pm
    • For Amusement Only e.V.
Re: Patching Daytona in m2emulator
« Reply #19 on: May 05, 2014, 03:36:37 pm »
You can run it on the same machine too. No explicit need for another machine.

As for the lamp outputs. Funny enough, either there is something I've missed, or there is a "bug" in the i960 emulation (which i doubt).

Neither MAME, nor M2EM can read the lamp state.
I can see the read in MAME, however the i960 R-register used stays 0x00000000 all the time.
If I patch the code to use a G-register, everything works as expected... Oo
I do all that stuff even without a Joystick ;)
Soft-15kHz, cabMAME, For Amusement Only e.V.


Jitterdoomer

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 58
  • Last login:February 26, 2023, 06:37:11 am
  • I want to build my own arcade controls!
    • Personal Twitter Page
Re: Patching Daytona in m2emulator
« Reply #20 on: May 05, 2014, 04:15:34 pm »
Waaaa? I thought that Model 2 emu doesn't have i960 bug that we need to run lamp inputs, what's going on? Well, I just go with my laptop to emulate it as a tower for controlling the game.
« Last Edit: May 05, 2014, 04:17:42 pm by Jitterdoomer »
For amusement only.

Jitterdoomer

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 58
  • Last login:February 26, 2023, 06:37:11 am
  • I want to build my own arcade controls!
    • Personal Twitter Page
Re: Patching Daytona in m2emulator
« Reply #21 on: May 05, 2014, 04:24:58 pm »
the nearby dave and busters has an 8 player special edition. I had no idea they made daytona cabs with motion control seats. Being toss around in the seat threw me off my game and i was lucky i didnt tell the people i was with " i play this game all time at home all the time" since i did poorly. lol

Same goes with Outrun 2 SDX, which was a replacement for the old Daytona USA cabs back in the day, they added two steering wheels on one car so that you or your buddy would drive at the same time, when you crash or kissing the grass, your partnert will drive and gladly it was bigger than Daytona Special Cabs.
For amusement only.

SailorSat

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 1238
  • Last login:Today at 06:58:15 pm
    • For Amusement Only e.V.
Re: Patching Daytona in m2emulator
« Reply #22 on: May 05, 2014, 05:17:00 pm »
got it.
replaced all those LDOB/STOB opcodes with LD/ST and now everything works.

grab the script in the first post and give daytona (saturn ads) a try :)
RAMBASE + 0x824 got the lamp data

0x01 - coin chute 1
0x02 - coin chute 2
0x04 - start
0x08 - view 1
0x10 - view 2
0x20 - view 3
0x40 - view 4
0x80 - leader
I do all that stuff even without a Joystick ;)
Soft-15kHz, cabMAME, For Amusement Only e.V.


SailorSat

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 1238
  • Last login:Today at 06:58:15 pm
    • For Amusement Only e.V.
Re: Patching Daytona in m2emulator
« Reply #23 on: May 05, 2014, 05:39:20 pm »
updated the script again. smaller and (simpler) now.
I do all that stuff even without a Joystick ;)
Soft-15kHz, cabMAME, For Amusement Only e.V.


Howard_Casto

  • Idiot Police
  • Trade Count: (+1)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 19427
  • Last login:Yesterday at 12:48:28 pm
  • Your Post's Soul is MINE!!! .......Again??
    • The Dragon King
Re: Patching Daytona in m2emulator
« Reply #24 on: May 05, 2014, 05:53:05 pm »
Great work man. 

Jitterdoomer

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 58
  • Last login:February 26, 2023, 06:37:11 am
  • I want to build my own arcade controls!
    • Personal Twitter Page
Re: Patching Daytona in m2emulator
« Reply #25 on: May 05, 2014, 06:42:30 pm »
GG   :applaud:
For amusement only.

baritonomarchetto

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 822
  • Last login:July 05, 2025, 10:19:35 am
Re: Patching Daytona in m2emulator
« Reply #26 on: May 06, 2014, 03:12:06 am »
Ok, it's "stupid questions" time: how can this script be effectively used in a cabinet?

I mean: you place the script in the right folder in M2Emu, then is a program like Mamehooker needed? Troubleshooter maybe?

(thanks  :))

Howard_Casto

  • Idiot Police
  • Trade Count: (+1)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 19427
  • Last login:Yesterday at 12:48:28 pm
  • Your Post's Soul is MINE!!! .......Again??
    • The Dragon King
Re: Patching Daytona in m2emulator
« Reply #27 on: May 06, 2014, 03:34:22 am »
I'm sure SailorSat is going to use a custom solution BUT.....

You would use the new script along with troubleshooter 2 and mamehooker. 

A new troubleshooter memcfg file would have to be made for Daytona which reads the new memory address of rambase+0x824 and bitmasks all the lamps into outputs (pretty easy). 

It would pass those along to mamehooker and it would work as normal. 

Natively m2 emulator doesn't support outputs.  We can read their states via the lua scripts, but something external has to be called.  RamJet's app and TS2 are the only applications that do memory reads to actually do something with the memory locations afaik. 

 

« Last Edit: May 06, 2014, 03:39:49 am by Howard_Casto »

SailorSat

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 1238
  • Last login:Today at 06:58:15 pm
    • For Amusement Only e.V.
Re: Patching Daytona in m2emulator
« Reply #28 on: May 07, 2014, 03:20:52 pm »
I'm sure SailorSat is going to use a custom solution BUT.....
ME? Nah xD

I figured out what EX.START (F4 in my script) does.
It means "extended start" and as long as it is pressed down, it will keep the game in track selection screen (so other ppl can join in) without the 15 second countdown.

Also I found to additional lamps (used on special type cabinets) for "ready for tower" (OFF in attract, ON if ingame [trackselection +]) and "ccd priority" (used for video cameras). I haven't rewrote them yet, as they are mixed in the force feedback stream (command 0xE0-0xE3) and I personaly don't need em (yet).
I do all that stuff even without a Joystick ;)
Soft-15kHz, cabMAME, For Amusement Only e.V.


Jitterdoomer

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 58
  • Last login:February 26, 2023, 06:37:11 am
  • I want to build my own arcade controls!
    • Personal Twitter Page
Re: Patching Daytona in m2emulator
« Reply #29 on: May 07, 2014, 03:32:28 pm »
Did ramjet made a Hydraulic Seat LUA? BTW, the "live cam" feature will be programmed with your video capturing device. Right now, MAME doesn't support camera feature as of now.

If it's done on an actual special cabinet, it'll be like two years of conversion.
« Last Edit: May 07, 2014, 03:34:55 pm by Jitterdoomer »
For amusement only.

SailorSat

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 1238
  • Last login:Today at 06:58:15 pm
    • For Amusement Only e.V.
Re: Patching Daytona in m2emulator
« Reply #30 on: May 07, 2014, 03:45:19 pm »
Well I think to control a real special type cabinet from either M2EM or MAME will require some extensive tweaking. A simple PacDrive (or any other 16+ channel lamp/led driver) should be enough though.

first 8 channels for the Lamps & Chutes.
seconds 8 channels for the 6 hydraulics and the 2 additional lamps.

the ccd cameras are handled by control tower. actually these are standard ntsc cameras and the control tower is a big 8 channel switcher. they will show the players on additional screens (usually on top of the game screens). nothing to spectacular...

my live cam "hack" is something different as it aims towards an ingame spectator mode.
I do all that stuff even without a Joystick ;)
Soft-15kHz, cabMAME, For Amusement Only e.V.


AMG KC

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 79
  • Last login:June 29, 2022, 05:33:52 am
Re: Patching Daytona in m2emulator
« Reply #31 on: May 09, 2014, 11:08:13 pm »
Is there going to be a repair for the network problem?

BigPanik

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 28
  • Last login:Yesterday at 05:57:21 pm
  • I want to build my own arcade controls!
Re: Patching Daytona in m2emulator
« Reply #32 on: June 14, 2014, 03:33:09 pm »
 :applaud: Great job girl!

I have already buid a program than hook the force feedback command byte to send it to the genuine SEGA Drive board via an arduino.

Now, we can light the lamps, with the same Arduino and same ULN2003 chip than used on I/O board.

I already try to modify my program, but your lamp byte is locate inside the emulator RAM. I need to read your magical byte from an external program, do you have any tips for me?


BigPanik

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 28
  • Last login:Yesterday at 05:57:21 pm
  • I want to build my own arcade controls!
Re: Patching Daytona in m2emulator
« Reply #33 on: June 14, 2014, 04:56:59 pm »
I reply myself to my question.

Posted by Howard_Casto in Feb 2013:
Quote
On the programmer side:

1.  Use a convoluted api like CreateToolhelp32Snapshot to help you find the base address of model 2, it's always 0x400000 - this step takes a bit of elfin magic, but I found some example code. 

2.  In a art money table, there's a section for all the relative spaces, the first one, which is the 50000 we added to our table looks like this:

"WorkRAM 1Mb","00500000","emulator_multicpu.exe+P0018F930,100h,

Ignore the workram bit, that's just a label.  The 500000 will be our reference point as I said before, emulator_multcpu.exe means the base address of the exe (again 40000), the P00.... is a POINTER to an address that contains yet another pointer to our value.  The 100h means once we find that address add 0x100 and that's the address to the final pointer.

3. Knowing all of that above we now use a get memory function to read 8 bytes (long) from the address 40000+0x18F930, that'll get us our first pointer

4.  Now we read a long at the address we just found +0x100, this is the  physical address  to 50000, or the work ram for model 2.

5.  Remember all of those offsets that you were supposed to determine on the user end?  You can now get the actual value of any of those addresses by reading with teh address found in #4 + the offset. 

Yeah that's about as simple as riding a unicycle. 

Thanks a lot, now my code is able to control FFB and lamps:
« Last Edit: June 14, 2014, 07:13:07 pm by BigPanik »

retrorepair

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 252
  • Last login:Yesterday at 06:47:43 pm
Re: Patching Daytona in m2emulator
« Reply #34 on: June 14, 2014, 09:15:13 pm »
Fantastic work guys  :applaud:

I can't tell you how long I spent looking for the lamp values in Daytona.

I did speak with ElSemi at some point and apparently the values should have been where they are in every other game but a bug prevented it with Daytona.
My arcade racing setup:
My Youtube Channel: http://www.youtube.com/user/RetroRepair
My Twitter: http://twitter.com/retrorepair

SailorSat

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 1238
  • Last login:Today at 06:58:15 pm
    • For Amusement Only e.V.
Re: Patching Daytona in m2emulator
« Reply #35 on: June 16, 2014, 03:44:25 am »
Mhm... That arduino interface sounds interesting :D
I do all that stuff even without a Joystick ;)
Soft-15kHz, cabMAME, For Amusement Only e.V.


baritonomarchetto

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 822
  • Last login:July 05, 2025, 10:19:35 am
Re: Patching Daytona in m2emulator
« Reply #36 on: June 17, 2014, 10:44:41 am »
Why i feel like the only one here not having fun with the lamp control, even if it was explained how to use it in some previous post? Because probably i AM the only one that understand half of what you are writing when "memory regions" and "masks" pops up  :banghead:

RamjetR

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 144
  • Last login:July 04, 2021, 03:27:58 am
    • My Youtube Channel
Re: Patching Daytona in m2emulator
« Reply #37 on: June 26, 2014, 07:49:36 pm »
Hi all, I was just talking to a friend about my arcades today and got me thinking I should log back in and see what the community has been getting up too... and wow have you all been busy. Great work hacking daytona and model 2 more...

Apparently new versions of the emulator too! It's been 16months since I've done anything arcade and looking forward to getting to put them back together to finish some off and play a bit more now that I've moved house officially.

Studying my dual bachelor of IT and electrical engineering and had 2 other jobs since I was last here and alot of catching up to do... So I'll get to reading pages of backstory hey?

Ramjet :)
Gentlemen.... Start your engines!
My Youtube Channel http://www.youtube.com/user/ramjetr?feature=mhee
Try my RamjetM2Borderless V0.7 utility for your M2Emulator shooting games here https://docs.google.com/open?id=0B-P3wlCiYEm3RzhCZk1NcFR3blE
Try my Sega Model 2 Output Utility RamjetVR V1.4 https://docs.google.com/file/d/0B-P3wlCiYEm3VHhBMXNxZGVIQk0/edit

supernono

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 11
  • Last login:December 11, 2024, 01:06:21 pm
  • I want to build my own arcade controls!
Re: Patching Daytona in m2emulator
« Reply #38 on: July 25, 2014, 07:18:28 pm »

You would use the new script along with troubleshooter 2 and mamehooker. 

A new troubleshooter memcfg file would have to be made for Daytona which reads the new memory address of rambase+0x824 and bitmasks all the lamps into outputs (pretty easy). 

It would pass those along to mamehooker and it would work as normal. 
 

hi all,  is someone trying to write this new troubleshooter memcfg file or can tell me how to do this ?
« Last Edit: July 25, 2014, 07:25:27 pm by supernono »

Howard_Casto

  • Idiot Police
  • Trade Count: (+1)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 19427
  • Last login:Yesterday at 12:48:28 pm
  • Your Post's Soul is MINE!!! .......Again??
    • The Dragon King
Re: Patching Daytona in m2emulator
« Reply #39 on: July 26, 2014, 02:38:57 pm »
I'm finishing up my racing rig as we speak.  If you'll be patient, I'll add the ini myself later this summer. 

supernono

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 11
  • Last login:December 11, 2024, 01:06:21 pm
  • I want to build my own arcade controls!
Re: Patching Daytona in m2emulator
« Reply #40 on: July 26, 2014, 03:30:56 pm »
ok i'm waiting

Dozer316

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 16
  • Last login:February 08, 2025, 09:22:14 am
  • I want to build my own arcade controls!
Re: Patching Daytona in m2emulator
« Reply #41 on: September 08, 2014, 12:35:12 pm »
Hi Howard,

Was a new TS memcfg ever released for the new daytona memory lamp locations?

If not I wouldn't mind having a crack at it myself but was wondering what the "&h" prefixes mean in the current set of ts.ini files I've seen.

Would these new locations be entered as bit mask values like the current entries in vf2.ini etc?

Thanks in advance.


Boomslang

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 1063
  • Last login:January 01, 2024, 08:20:43 pm
  • I want to build my own arcade controls!
Re: Patching Daytona in m2emulator
« Reply #42 on: September 26, 2014, 05:43:18 am »
can Daytona be hacked to raise the laps during endurance race? In Daytona USA the max is 80 laps for Beginner however in Daytona USA 2 you can set it up to 500 laps which takes around 3 hours!! Id love to have Daytona USA be up to 500 laps as well

SailorSat

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 1238
  • Last login:Today at 06:58:15 pm
    • For Amusement Only e.V.
Re: Patching Daytona in m2emulator
« Reply #43 on: September 26, 2014, 08:08:33 am »
It will show track 81/80 etc. but it is possible. However, I don't know if the track limit is 8bit (255 laps) or 16bit
I do all that stuff even without a Joystick ;)
Soft-15kHz, cabMAME, For Amusement Only e.V.


Boomslang

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 1063
  • Last login:January 01, 2024, 08:20:43 pm
  • I want to build my own arcade controls!
Re: Patching Daytona in m2emulator
« Reply #44 on: September 26, 2014, 04:25:59 pm »
Awesome! I'd love that so much.....how the hell can I do it? Properly assuming I can't  :hissy:

I always thought the 80 Lapa from Daytona 1 was too short

MrThunderwing

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 1087
  • Last login:July 05, 2025, 10:58:29 am
  • As I pass, do I give you the ass or the crotch?
Re: Patching Daytona in m2emulator
« Reply #45 on: September 28, 2014, 02:54:18 pm »
(This is just a normal non-patched LAN game)



« Last Edit: September 26, 2015, 06:25:37 am by MrThunderwing »

RamjetR

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 144
  • Last login:July 04, 2021, 03:27:58 am
    • My Youtube Channel
Re: Patching Daytona in m2emulator
« Reply #46 on: September 29, 2014, 07:10:01 pm »
got it.
replaced all those LDOB/STOB opcodes with LD/ST and now everything works.

grab the script in the first post and give daytona (saturn ads) a try :)
RAMBASE + 0x824 got the lamp data

0x01 - coin chute 1
0x02 - coin chute 2
0x04 - start
0x08 - view 1
0x10 - view 2
0x20 - view 3
0x40 - view 4
0x80 - leader

Hi SailorSat,

Did you have to replace opcodes in the source or the rom for the lamp outputs to become available? I tried the above RAMBASE + 0x824 and still don't have any readings, is there a new exe available to test with?

Thanks,
Ramjet. :)
Gentlemen.... Start your engines!
My Youtube Channel http://www.youtube.com/user/ramjetr?feature=mhee
Try my RamjetM2Borderless V0.7 utility for your M2Emulator shooting games here https://docs.google.com/open?id=0B-P3wlCiYEm3RzhCZk1NcFR3blE
Try my Sega Model 2 Output Utility RamjetVR V1.4 https://docs.google.com/file/d/0B-P3wlCiYEm3VHhBMXNxZGVIQk0/edit

SailorSat

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 1238
  • Last login:Today at 06:58:15 pm
    • For Amusement Only e.V.
Re: Patching Daytona in m2emulator
« Reply #47 on: September 30, 2014, 11:07:05 am »
There is a script attached to the first post that does patch the roms (in memory) on load. No new roms required :)
I do all that stuff even without a Joystick ;)
Soft-15kHz, cabMAME, For Amusement Only e.V.


BigPanik

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 28
  • Last login:Yesterday at 05:57:21 pm
  • I want to build my own arcade controls!
Re: Patching Daytona in m2emulator
« Reply #48 on: October 17, 2014, 04:46:30 am »
Mhm... That arduino interface sounds interesting :D

Yes it is:



« Last Edit: October 17, 2014, 04:49:30 am by BigPanik »

SaturnAR

  • Trade Count: (0)
  • Newbie
  • *
  • Offline Offline
  • Posts: 1
  • Last login:December 28, 2014, 12:19:02 pm
  • SEGA Saturn shiro!
Re: Patching Daytona in m2emulator
« Reply #49 on: November 14, 2014, 02:58:54 pm »
My board, with no original board needed to do it.  ;D



Just my custom-made usb board, PC controller software and of course, a Daytona USA driving kit. This one uses a 100V AC motor.

Boomslang

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 1063
  • Last login:January 01, 2024, 08:20:43 pm
  • I want to build my own arcade controls!
Re: Patching Daytona in m2emulator
« Reply #50 on: April 18, 2015, 07:28:47 pm »
How can I use the special type inputs?

Im not sure what im meant to actually do to get them working

SailorSat

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 1238
  • Last login:Today at 06:58:15 pm
    • For Amusement Only e.V.
Re: Patching Daytona in m2emulator
« Reply #51 on: April 19, 2015, 04:53:04 am »
How can I use the special type inputs?

Im not sure what im meant to actually do to get them working

1. using the script on the first post:
F4 is mapped to "extended start" (as long as you hold it, the join-in timer in multiplayer should be disabled)
F5 is mapped to the "emergency" / "remote start". If you tap in attract mode, the game will start as if you had pressed the start button. if you hold it ingame, the seat movement (and force feedback) should stop for as long as you keep it pressed down.

the track selection is not mapped in the default script - it is documented in the script though.
I do all that stuff even without a Joystick ;)
Soft-15kHz, cabMAME, For Amusement Only e.V.


alex_cs

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 10
  • Last login:March 23, 2017, 06:20:58 pm
  • I want to build my own arcade controls!
Re: Patching Daytona in m2emulator
« Reply #52 on: June 17, 2015, 12:24:02 am »
Hey guys,

Excellent work on this!
I've got a pacdrive and am hoping to get the script to interface to the controller.

Does anybody have the memcfg file to put into the trouble shooter or a guide how to code on the ram base address? Having a bit of trouble.
Help would be appreciated!
« Last Edit: June 17, 2015, 03:09:49 am by alex_cs »

alex_cs

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 10
  • Last login:March 23, 2017, 06:20:58 pm
  • I want to build my own arcade controls!
Re: Patching Daytona in m2emulator
« Reply #53 on: July 14, 2015, 08:57:48 pm »
I ended up working out the memcfg file to the memory addresses and it all works great with the pacdrive. Has anybody got this memory hacking working with mamehooker on m2 emulator version 1.1a ?

Regards, Alex.

supernono

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 11
  • Last login:December 11, 2024, 01:06:21 pm
  • I want to build my own arcade controls!
Re: Patching Daytona in m2emulator
« Reply #54 on: July 31, 2015, 07:19:03 am »
I am interested in your memcfg file

BadMouth

  • Moderator
  • Trade Count: (+6)
  • Full Member
  • *****
  • Offline Offline
  • Posts: 9270
  • Last login:Yesterday at 06:18:43 pm
  • ...
Re: Patching Daytona in m2emulator
« Reply #55 on: July 31, 2015, 10:10:37 am »
My board, with no original board needed to do it.  ;D



Just my custom-made usb board, PC controller software and of course, a Daytona USA driving kit. This one uses a 100V AC motor.


No details, no useful.  :'(


supernono

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 11
  • Last login:December 11, 2024, 01:06:21 pm
  • I want to build my own arcade controls!
Re: Patching Daytona in m2emulator
« Reply #56 on: August 09, 2015, 04:29:23 pm »

You would use the new script along with troubleshooter 2 and mamehooker. 

A new troubleshooter memcfg file would have to be made for Daytona which reads the new memory address of rambase+0x824 and bitmasks all the lamps into outputs (pretty easy). 

It would pass those along to mamehooker and it would work as normal. 
 

i'm looking for this new troubleshooter memcfg file

is there somebody writing it ?
« Last Edit: August 09, 2015, 05:17:01 pm by supernono »

beeflecake

  • Trade Count: (0)
  • Jr. Member
  • **
  • Offline Offline
  • Posts: 3
  • Last login:November 25, 2015, 11:43:23 am
  • I want to build my own arcade controls!
Re: Patching Daytona in m2emulator
« Reply #57 on: September 23, 2015, 12:34:04 pm »
Quote
i'm looking for this new troubleshooter memcfg file

Hello.
I have the same problem. If someone could explain to me how to use TS2 with the patch version of Daytona USA.

Thanks a lot.



Howard_Casto

  • Idiot Police
  • Trade Count: (+1)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 19427
  • Last login:Yesterday at 12:48:28 pm
  • Your Post's Soul is MINE!!! .......Again??
    • The Dragon King
Re: Patching Daytona in m2emulator
« Reply #58 on: September 26, 2015, 12:47:30 am »
That isn't a problem guys.  I haven't made one yet. 

Don't take this the wrong way, but I've been away for about a year due to medical problems and over the past 4 or 5 months I've managed to release a full mod for MK:KE and the latest version of Outrun 2 FXT.  I'm good, but I'm not Jesus. 

beeflecake

  • Trade Count: (0)
  • Jr. Member
  • **
  • Offline Offline
  • Posts: 3
  • Last login:November 25, 2015, 11:43:23 am
  • I want to build my own arcade controls!
Re: Patching Daytona in m2emulator
« Reply #59 on: September 26, 2015, 02:37:03 am »
Ok. Thanks for your answer and your work. I can waiting.


 


BigPanik

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 28
  • Last login:Yesterday at 05:57:21 pm
  • I want to build my own arcade controls!
Re: Patching Daytona in m2emulator
« Reply #60 on: October 28, 2015, 12:13:22 pm »
I has quickly unsuccessfully try the "special type" inputs. Does it's working in single cab mode?

Thanks

SailorSat

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 1238
  • Last login:Today at 06:58:15 pm
    • For Amusement Only e.V.
Re: Patching Daytona in m2emulator
« Reply #61 on: October 28, 2015, 12:25:13 pm »
To be honest, I never tried the special inputs in solo mode.

The game has to be set to "special" cabinet for the inputs to work.
I do all that stuff even without a Joystick ;)
Soft-15kHz, cabMAME, For Amusement Only e.V.


BigPanik

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 28
  • Last login:Yesterday at 05:57:21 pm
  • I want to build my own arcade controls!
Re: Patching Daytona in m2emulator
« Reply #62 on: October 29, 2015, 12:19:44 pm »
The game has to be set to "special" cabinet for the inputs to work.

OK, my mistake.

So, "Extended start" don't work in single but "Emergency/remote start" work fine. Also try with success the "track selection" option.

Thanks

Nuexzz

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 279
  • Last login:October 01, 2023, 01:26:58 am
Re: Patching Daytona in m2emulator
« Reply #63 on: October 29, 2015, 11:29:41 pm »
If you can extend the startup time in single player , I have to find the code on my old hard

Boomslang

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 1063
  • Last login:January 01, 2024, 08:20:43 pm
  • I want to build my own arcade controls!
Re: Patching Daytona in m2emulator
« Reply #64 on: October 17, 2016, 04:08:40 am »
Sorry for bumping an old post here but I've still been waiting for memcfg file to be updated for m2 emulator 1.1a for the VR lights and it's never been done after 2 years or so


I attempted it briefly but kept getting errors so I must be doing something wrong

since SailorSat's lua script is for daytonas then i looked up the daytonas file in memcfg and it has the old stuff from m2 emulator 1.0 currently

[Info]
Name=Daytona USA (Saturn Ads)
WinCaption=Daytona USA (Saturn Ads)
WinClass=MYWIN
ExeName=
ExePath=
LaunchGame=0
Enable=1
ExitMode=1
[Inputs]

[Outputs]
Enable=1
EmuName=Model2
NumberOutputs=6

Output1PTR=&H18F930|&h100|&H10D0
Output1Type=integer
Output1Name=Fake_TimeLeft

Output2PTR=&H18F930|&h100|&H1710
Output2Type=byte
Output2Name=Fake_VRView

Output3PTR=&H18F930|&h100|&H51EC
Output3Type=integer
Output3Name=Fake_Position

Output4PTR=&H18F930|&h100|&H52CC
Output4Type=integer
Output4Name=Fake_Gear

Output5PTR=&H18F930|&h100|&H52D8
Output5Type=integer
Output5Name=Fake_RPM

Output6PTR=&H18F930|&h100|&H5198
Output6Type=integer
Output6Name=Fake_KPH



Howard_Casto

  • Idiot Police
  • Trade Count: (+1)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 19427
  • Last login:Yesterday at 12:48:28 pm
  • Your Post's Soul is MINE!!! .......Again??
    • The Dragon King
Re: Patching Daytona in m2emulator
« Reply #65 on: October 17, 2016, 03:34:01 pm »
Sorry man.  I'm just as frustrated at the pace I go these days as you are.  I was just allowed to do stuff this week, so I've been working on my racing rig a little each day.  Today I got the custom plate for the VR + misc buttons finished and cut for the cab.  Believe it or not this was probably the most involved and time consuming step besides the finish. 

I'm hoping to have my cab finished (or at least finished enough.  Sometime this week.  Then I'm going to work on one game at a time and Daytona is probably towards the top of the list, right below Outrun FXT. 

I would say I'll take a look but honestly it's been so long since I worked on ts2 that it would probably be a while before I figured out what was wrong. 

Boomslang

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 1063
  • Last login:January 01, 2024, 08:20:43 pm
  • I want to build my own arcade controls!
Re: Patching Daytona in m2emulator
« Reply #66 on: October 17, 2016, 04:30:55 pm »
No worries Howard

Health comes first mate but it's good to hear you are getting to work on your cabinet a bit!

Has anyone managed to get these lamp outputs working with TS2?

Sailorsat posted

RAMBASE + 0x824 got the lamp data

0x01 - coin chute 1
0x02 - coin chute 2
0x04 - start
0x08 - view 1
0x10 - view 2
0x20 - view 3
0x40 - view 4
0x80 - leader

So I assumed I could set

Output2PTR=&H824|&h8|&H10|&h20|&h40
Output2Type=byte
Output2Name=Real_VRView

I just got errors


Howard_Casto

  • Idiot Police
  • Trade Count: (+1)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 19427
  • Last login:Yesterday at 12:48:28 pm
  • Your Post's Soul is MINE!!! .......Again??
    • The Dragon King
Re: Patching Daytona in m2emulator
« Reply #67 on: October 17, 2016, 05:32:50 pm »
Ok I can tell you what is wrong at least. 

Output2PTR means "memory pointer to output 2"  So it starts with a relative static address, (exe address + offset) and then you keep adding offsets and what-not via bars until the dynamic address comes out the other end.  It doesn't have anything to do with the bit-wise reading, which I'm assuming you were trying to use it for based upon the data you put in.  There are other memcfg files that show how to do bitwise reading (basically you make multiple outputs of the same address, set them up as a single byte, and then filter for the bit you want to read. )  That's problem #1.

Problem #2 is "RAMBASE"  Rambase is a pre-defined memory location in model 2 hardware that is accessable to lua via the "RAMBASE" macro.  Obviously no such macro exists in ts2, it could be different for each revision of model 2 emu, so we have to find it manually.  I'm sure there are some variables I used in previous memcfgs that access the rambase, but I can't remember which.  I'm also unsure if it would even matter, since, as I said, it could vary from version to version.

So yeah, not as straightforward as you were thinking.  There's a reason I've been putting the next release of ts2 off.  ;)


Boomslang

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 1063
  • Last login:January 01, 2024, 08:20:43 pm
  • I want to build my own arcade controls!
Re: Patching Daytona in m2emulator
« Reply #68 on: October 17, 2016, 05:40:42 pm »
I'll just keep waiting then :p

What's another year or so.

I've kept using m2 emulator 1.0 for a reason until now

Howard_Casto

  • Idiot Police
  • Trade Count: (+1)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 19427
  • Last login:Yesterday at 12:48:28 pm
  • Your Post's Soul is MINE!!! .......Again??
    • The Dragon King
Re: Patching Daytona in m2emulator
« Reply #69 on: October 17, 2016, 11:03:01 pm »
Eh I doubt it'll be that long.  Maybe a month or so.   I got the front grill of my cab mounted, so tomorrow I'll wire up all the VR lights and slap on some temp speakers (long story).  The front end is already on the cab ready to go with most of the games installed.  So assuming my I/O Arduino code works (it should as it worked when I had it plugged into my desktop.)  I'll go straight to fiddling.  2k6 is going to be an ongoing project, so like most of my stuff I'll work on it a week or so and jump to something else. 

It's a shame about the eye surgery.  My guess is I won't get to hand turning a wooden wheel or finishing the shifter and yoke before it gets cold.  But hey.... I'll be glad to have it act as something other than a coat rack this winter. 

Boomslang

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 1063
  • Last login:January 01, 2024, 08:20:43 pm
  • I want to build my own arcade controls!
Re: Patching Daytona in m2emulator
« Reply #70 on: October 18, 2016, 12:15:37 am »
Ok I can tell you what is wrong at least. 

Output2PTR means "memory pointer to output 2"  So it starts with a relative static address, (exe address + offset) and then you keep adding offsets and what-not via bars until the dynamic address comes out the other end.  It doesn't have anything to do with the bit-wise reading, which I'm assuming you were trying to use it for based upon the data you put in.  There are other memcfg files that show how to do bitwise reading (basically you make multiple outputs of the same address, set them up as a single byte, and then filter for the bit you want to read. )  That's problem #1.

Problem #2 is "RAMBASE"  Rambase is a pre-defined memory location in model 2 hardware that is accessable to lua via the "RAMBASE" macro.  Obviously no such macro exists in ts2, it could be different for each revision of model 2 emu, so we have to find it manually.  I'm sure there are some variables I used in previous memcfgs that access the rambase, but I can't remember which.  I'm also unsure if it would even matter, since, as I said, it could vary from version to version.

So yeah, not as straightforward as you were thinking.  There's a reason I've been putting the next release of ts2 off.  ;)

I forgot to say I actually have the RAMBASE address for m2 emulator 1.1a if thats a step forward

Howard_Casto

  • Idiot Police
  • Trade Count: (+1)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 19427
  • Last login:Yesterday at 12:48:28 pm
  • Your Post's Soul is MINE!!! .......Again??
    • The Dragon King
Re: Patching Daytona in m2emulator
« Reply #71 on: October 19, 2016, 02:28:47 am »
Yeah that helps....... let me throw some ini at ya. 

...........................................................................

Output1PTR=&H18F930|&h100|&HCDD38
Output1Type=byte
Output1BitMask=16
Output1Name=Start_Lamp

Output2PTR=&H18F930|&h100|&HCDD38
Output2Type=byte
Output2BitMask=32
Output2Name=VR1_Lamp

.............................................

That's how you do bitmasking..... notice that the address is the same and the only thing changed is the bitmask filter.  Note that you can use hex if you prefer. 

Also you have you three memeory addresses.... If it's a static address (same location in computer's memory every time) use the "Output1Addr" instead and just type the address... no need for bars.  If it's a simple exe offset (shows up as m2emulator.exe+0xaddress in cheat engine) you can just put two bars followed by the address like "Output2PTR="||&H18F930".  The other two slots in the bar are for offsets from the offset and honestly it gets confusing, so It may be better if I do it if that is necessary.

Anyway I wired up all the buttons on my rig tonight and the leds and inputs are functioning properly... so I should be able to help soon. 

Boomslang

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 1063
  • Last login:January 01, 2024, 08:20:43 pm
  • I want to build my own arcade controls!
Re: Patching Daytona in m2emulator
« Reply #72 on: October 19, 2016, 03:26:47 am »
so if emulator_multicpu.exe+12C678 is the rambase with an offset of 100 and then VR lights are the rambase + 824 with the offsets of VR1,VR2,VR3 and VR4 being the
0x08 - view 1
0x10 - view 2
0x20 - view 3
0x40 - view 4


Is it meant to be something like

Output2PTR=&H12C678|&h100|&H824
Output2Type=byte
Output2BitMask=8
Output2Name=VR1_Lamp

Howard_Casto

  • Idiot Police
  • Trade Count: (+1)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 19427
  • Last login:Yesterday at 12:48:28 pm
  • Your Post's Soul is MINE!!! .......Again??
    • The Dragon King
Re: Patching Daytona in m2emulator
« Reply #73 on: October 19, 2016, 02:30:00 pm »
Yeah just like that.  Just note that "0x" = "&H" in ts2 as that's a hex number. 

Boomslang

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 1063
  • Last login:January 01, 2024, 08:20:43 pm
  • I want to build my own arcade controls!
Re: Patching Daytona in m2emulator
« Reply #74 on: October 19, 2016, 04:59:12 pm »
I tried that last night though and still wasnt getting it working

Obviously I used the proper rambase address etc but I did notice it has a offset of 100 and another with 0 but I tried them all

Unless I was meant to do

Output2BitMask=&h8

Although rambase does show offset of 100 and 0
« Last Edit: October 19, 2016, 05:07:51 pm by Boomslang »

Howard_Casto

  • Idiot Police
  • Trade Count: (+1)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 19427
  • Last login:Yesterday at 12:48:28 pm
  • Your Post's Soul is MINE!!! .......Again??
    • The Dragon King
Re: Patching Daytona in m2emulator
« Reply #75 on: October 19, 2016, 08:21:31 pm »
I got your pm... I'll try to take a look at it this weekend.

Boomslang

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 1063
  • Last login:January 01, 2024, 08:20:43 pm
  • I want to build my own arcade controls!
Re: Patching Daytona in m2emulator
« Reply #76 on: October 21, 2016, 01:59:26 am »
Good news is I got it going finally

Its not quite 100% as i couldn't seem to get SailorSat script to work with having
ROM = "daytonas"
require("TS2");

added to the lua file, for some reason it would stop the patch working and just sit everything at 00 so I just copied the function init from TS2 into my daytona script and then everything worked fine

works fine with daytona and daytonas using the same script file


Howard_Casto

  • Idiot Police
  • Trade Count: (+1)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 19427
  • Last login:Yesterday at 12:48:28 pm
  • Your Post's Soul is MINE!!! .......Again??
    • The Dragon King
Re: Patching Daytona in m2emulator
« Reply #77 on: October 21, 2016, 02:36:47 am »
Well it's probably better to merge them anyway.....  K.I.S.S. and all.   I looked at SailorSat's script and while I can replicate it in code, it wouldn't be possible via a memcfg file as there are some conditional patches in there. 

Boomslang

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 1063
  • Last login:January 01, 2024, 08:20:43 pm
  • I want to build my own arcade controls!
Re: Patching Daytona in m2emulator
« Reply #78 on: October 21, 2016, 04:51:15 am »
Attempted to make a quick video but it doesn't show that well with my phone

Regardless, good news is Leader lights finally work over network. Leader lights worked fine on m2 emulator 1.0 but not over network, only for single player



« Last Edit: October 21, 2016, 04:59:24 am by Boomslang »

Boomslang

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 1063
  • Last login:January 01, 2024, 08:20:43 pm
  • I want to build my own arcade controls!
Re: Patching Daytona in m2emulator
« Reply #79 on: October 23, 2016, 06:46:40 am »
I played around tonight with daytona a bit. Ive always wanted there to be a way to race multiplayer but not just have it 1/2 etc but to include the AI cars similar to single player so you are racing out of 40 places instead of just 2 or 3 etc

I had mixed results, I got it to show all the AI cars on both networked game but only 1 monitor sees the other networked player, I couldn't seem to get it to see both cars on both screens however its sorta there as when you pass the invisible car it changes my position. I made a small video just to kinda show what i mean and you can see that my position drops as I pass AI cars etc. Im outa ideas on this unfortunately now


« Last Edit: October 23, 2016, 06:48:27 am by Boomslang »

Boomslang

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 1063
  • Last login:January 01, 2024, 08:20:43 pm
  • I want to build my own arcade controls!
Re: Patching Daytona in m2emulator
« Reply #80 on: October 23, 2016, 11:06:44 pm »
yay i got it going

just tested over 2 player then 3 player and worked well. Perhaps not interesting to anyone but Its cool for multiplayer network racing against all the AI cars aswell as your friends

I only know how to do this over cheat engine currently so will need someone who can script into the lua or something for this if anyone is interested


« Last Edit: October 24, 2016, 01:33:17 am by Boomslang »

Howard_Casto

  • Idiot Police
  • Trade Count: (+1)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 19427
  • Last login:Yesterday at 12:48:28 pm
  • Your Post's Soul is MINE!!! .......Again??
    • The Dragon King
Re: Patching Daytona in m2emulator
« Reply #81 on: October 24, 2016, 05:00:31 pm »
I'm interested, but you know the pace I go at.  You might want to release your output script in the meantime for those that want to use it. 

Boomslang

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 1063
  • Last login:January 01, 2024, 08:20:43 pm
  • I want to build my own arcade controls!
Re: Patching Daytona in m2emulator
« Reply #82 on: October 24, 2016, 06:38:06 pm »
Yep I'll post it tonight

I also made another which has the outputs aswell as 3 cheats I added to change the total lap number for longer endurance races 99 laps,180 laps or 255 laps. 255 is the most which can be done, just a small 9-10 hour endurance race on expert if anyone is keen  :lol

Boomslang

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 1063
  • Last login:January 01, 2024, 08:20:43 pm
  • I want to build my own arcade controls!
Re: Patching Daytona in m2emulator
« Reply #83 on: October 25, 2016, 12:52:20 am »
Firstly everyone can Thank SailorSat, she has done all the magic here really!! and I couldn't do any of it without her knowledge

Ill post 2 different lua files for using with TS2 etc

This one will get VR lights working with TS2 with no cheats

daytona.lua
Code: [Select]
ROM = "daytona"
require("model2"); -- Import model2 machine globals


function Init()
Patch_SpecialInputs();
Patch_LampOutputs();
os.execute ("tsstub.exe "..ROM)
end

function Patch_SpecialInputs()
-- first, disable old read
Romset_PatchDWord(0, 0x1E504, 0x5CA01E00); -- MOV g4,0x00 (NOOP?)

-- now jump to our patched read
Romset_PatchDWord(0, 0x1E508, 0x090219F8); -- CALL 0x0003FF00

-- read io port
Romset_PatchDWord(0, 0x3FF00, 0x80A03000);
Romset_PatchDWord(0, 0x3FF04, 0x01C00012); -- LDOB g4,0x01C00012

-- read patched mask
Romset_PatchDWord(0, 0x3FF08, 0x80B83000);
Romset_PatchDWord(0, 0x3FF0C, 0x00500820); -- LDOB g7,0x00500820

-- and em
Romset_PatchDWord(0, 0x3FF10, 0x58A50097); -- AND g4,g4,g7

-- restore old mask
Romset_PatchDWord(0, 0x3FF14, 0x8CB800FF); -- LDA g7,0xff

-- return
Romset_PatchDWord(0, 0x3FF18, 0x0A000000);  -- RET
end

function Patch_LampOutputs()
-- reroute 0x01C0001E to 0x00500824
for offset = 0x00000000, 0x0003FFFF, 4 do
if Romset_ReadDWord(0, offset) == 0x01C0001E then
Romset_PatchDWord(0, offset, 0x00500824);
local opcode = offset - 1;
if Romset_ReadByte(0, opcode) == 0x80 then
Romset_PatchByte(0, opcode, 0x90) -- replace LDOB with LD
end
if Romset_ReadByte(0, opcode) == 0x82 then
Romset_PatchByte(0, opcode, 0x92) -- replace STOB with ST
end
end
end
end

function PostDraw()
if I960_ReadByte(RAMBASE + 0x00000820) == 0x00 then
I960_WriteByte(RAMBASE + 0x00000820, 0xFF);
end

-- 0xFF = normal
-- 0xFD = force beginner
-- 0xFB = force advanced
-- 0xF9 = force expert

-- 0xF7 = emergency/remote start

-- 0x7F = ex.start; as long as hold down, the track selection stays on (even after the 15 second countdown)

-- 0x3E = DIK_F4
-- 0x3F = DIK_F5
local data = 0xFF;
data = XOR(SHL(Input_IsKeyPressed(0x3E), 0x07), data); -- F4 for ex.start
data = XOR(SHL(Input_IsKeyPressed(0x3F), 0x03), data);  -- F5 for emergency/remote start
I960_WriteByte(RAMBASE + 0x00000820, data);

Video_DrawText(0,0,HEX8(I960_ReadByte(0x00500824)),0xFFFFFF);
end



This one will get VR lights working with TS2 with cheats. I added time cheat, 99,180,255 max laps (will not change the visible out of lap icon eg 8,80 or whatever. Will simply say 99/8 then tick over to 00/8 once you hit 100 or 200 etc). Just modify the script if you don't want to change lap numbers


daytona.lua
Code: [Select]
ROM = "daytona"
require("model2"); -- Import model2 machine globals


function Init()
Patch_SpecialInputs();
Patch_LampOutputs();
os.execute ("tsstub.exe "..ROM)
end

function Patch_SpecialInputs()
-- first, disable old read
Romset_PatchDWord(0, 0x1E504, 0x5CA01E00); -- MOV g4,0x00 (NOOP?)

-- now jump to our patched read
Romset_PatchDWord(0, 0x1E508, 0x090219F8); -- CALL 0x0003FF00

-- read io port
Romset_PatchDWord(0, 0x3FF00, 0x80A03000);
Romset_PatchDWord(0, 0x3FF04, 0x01C00012); -- LDOB g4,0x01C00012

-- read patched mask
Romset_PatchDWord(0, 0x3FF08, 0x80B83000);
Romset_PatchDWord(0, 0x3FF0C, 0x00500820); -- LDOB g7,0x00500820

-- and em
Romset_PatchDWord(0, 0x3FF10, 0x58A50097); -- AND g4,g4,g7

-- restore old mask
Romset_PatchDWord(0, 0x3FF14, 0x8CB800FF); -- LDA g7,0xff

-- return
Romset_PatchDWord(0, 0x3FF18, 0x0A000000);  -- RET
end

function Patch_LampOutputs()
-- reroute 0x01C0001E to 0x00500824
for offset = 0x00000000, 0x0003FFFF, 4 do
if Romset_ReadDWord(0, offset) == 0x01C0001E then
Romset_PatchDWord(0, offset, 0x00500824);
local opcode = offset - 1;
if Romset_ReadByte(0, opcode) == 0x80 then
Romset_PatchByte(0, opcode, 0x90) -- replace LDOB with LD
end
if Romset_ReadByte(0, opcode) == 0x82 then
Romset_PatchByte(0, opcode, 0x92) -- replace STOB with ST
end
end
end
end

function PostDraw()
if I960_ReadByte(RAMBASE + 0x00000820) == 0x00 then
I960_WriteByte(RAMBASE + 0x00000820, 0xFF);
end

-- 0xFF = normal
-- 0xFD = force beginner
-- 0xFB = force advanced
-- 0xF9 = force expert

-- 0xF7 = emergency/remote start

-- 0x7F = ex.start; as long as hold down, the track selection stays on (even after the 15 second countdown)

-- 0x3E = DIK_F4
-- 0x3F = DIK_F5
local data = 0xFF;
data = XOR(SHL(Input_IsKeyPressed(0x3E), 0x07), data); -- F4 for ex.start
data = XOR(SHL(Input_IsKeyPressed(0x3F), 0x03), data);  -- F5 for emergency/remote start
I960_WriteByte(RAMBASE + 0x00000820, data);


end

function Frame()
local gameState = I960_ReadByte(0x5010A4)

if   gameState==0x16 -- Ingame
  or gameState==0x03 -- Attract ini
  or gameState==0x04 -- Attract Higscore ini
  or gameState==0x05 -- Attract Highscore
  or gameState==0x06 -- Attract VR Ini
  or gameState==0x07 -- Attract VR
then
Model2_SetStretchBLow(1) -- Stretch the bg tilemap (sky & clouds) when widescreen
Model2_SetWideScreen(1)
else -- No widescreen on the rest of the screens
Model2_SetStretchBLow(0)
Model2_SetWideScreen(0)
end

end

--Some sample code follows to show how to draw strings and setup options/cheats
--
--function PostDraw()
-- Video_DrawText(20,10,HEX32(I960_GetRamPtr(RAMBASE)),0xFFFFFF);
-- Video_DrawText(20,10,HEX32(I960_ReadWord(RAMBASE+0x10D0)),0xFFFFFF);
-- Video_DrawText(20,20,HEX32(RAMBASE),0xFFFFFF);
-- Video_DrawText(20,30,Options.cheat1.value,0xFFFFFF);
-- Video_DrawText(20,40,Input_IsKeyPressed(0x1E),0xFFFFFF);
--end
--
--function cheat1func(value)
--
--end
--
--function cheat1change(value)
--
--end
--
--
--function cheat2func(value)
--
--end
--
--function cheat2change(value)
--
--end
--
--

function lapcheatfunc2(value)
I960_WriteWord(RAMBASE+0x10EC,99);
end
function lapcheatfunc1(value)
I960_WriteWord(RAMBASE+0x10EC,180);
end
function lapcheatfunc(value)
I960_WriteWord(RAMBASE+0x10EC,255);
end
function timecheatfunc(value)
I960_WriteWord(RAMBASE+0x10D0,50*64); --50 seconds always
end


Options =
{
-- cheat4={name="Cheat 4",values={"Off","On"},runfunc=cheat4func,changefunc=cheat4change},
lapcheat4={name="99 Laps",values={"Off","On"},runfunc=lapcheatfunc2},
-- cheat3={name="Cheat 3",values={"Off","On"},runfunc=cheat3func,changefunc=cheat3change},
lapcheat1={name="180 Laps",values={"Off","On"},runfunc=lapcheatfunc1},
-- cheat2={name="Cheat 2",values={"Off","On"},runfunc=cheat2func,changefunc=cheat2change},
lapcheat={name="255 Laps",values={"Off","On"},runfunc=lapcheatfunc},
-- cheat1={name="Cheat 1",values={"Off","On"},runfunc=cheat1func,changefunc=cheat1change},
timecheat={name="Infinite Time",values={"Off","On"},runfunc=timecheatfunc}

}



This is the ini file to go into memcfg folder of TS2


daytona.ini
Code: [Select]
[Info]
Name=Daytona USA
WinCaption=Daytona USA
WinClass=MYWIN
ExeName=
ExePath=
LaunchGame=0
Enable=1
ExitMode=1
[Inputs]

[Outputs]
Enable=1
EmuName=Model2
NumberOutputs=9

Output1PTR=&H1AA888|&H100|&H824
Output1Type=byte
Output1BitMask=&h1
Output1Name=Coin Chute 1

Output2PTR=&H1AA888|&H100|&H824
Output2Type=byte
Output2BitMask=&h2
Output2Name=Coin Chute 2

Output3PTR=&H1AA888|&H100|&H824
Output3Type=byte
Output3BitMask=&h4
Output3Name=Start_Lamp

Output4PTR=&H1AA888|&H100|&H824
Output4Type=byte
Output4BitMask=&h8
Output4Name=View1_Lamp

Output5PTR=&H1AA888|&H100|&H824
Output5Type=byte
Output5BitMask=&h10
Output5Name=View2_Lamp

Output6PTR=&H1AA888|&H100|&H824
Output6Type=byte
Output6BitMask=&h20
Output6Name=View3_Lamp

Output7PTR=&H1AA888|&H100|&H824
Output7Type=byte
Output7BitMask=&h40
Output7Name=View4_Lamp

Output8PTR=&H1AA888|&H100|&H824
Output8Type=byte
Output8BitMask=&h80
Output8Name=Leader_Lamp

Output9PTR=&H1AA888|&H100|&H52D8
Output9Type=integer
Output9Name=RPM



oh and to get the network multiplayer going with AI positions is a little funky as It cannot be done before a race starts (goes back to test menu immediately if too soon) so I was hoping to add it as a cheat or similar to launch once im in a race but I need it to do a few things in a row as like a macro. I currently use cheat engine to do it

Step 1 - launch network multiplayer as per normal and start a race
Step 2 -  RAMBASE+4008 needs to be locked on all slave machines. Doesn't matter for Master it seems
Step 3 - RAMBASE+5484,RAMBASE+5784,RAMBASE+5A84,RAMBASE+5D84,RAMBASE+6084,RAMBASE+6384,RAMBASE+6684 needs to be locked too if you are playing 8 player to stop nodes from resetting (car 2-8 nodes)
Step 4 - RAMBASE+4000 needs to be changed to 99 (network will lose sync with each other)
Step 5 - RAMBASE+10A4 needs to be changed to 13 (restart entrance to race with 40 positions)
Step 6 - RAMBASE+4000 needs to be changed to 01 (network will re-sync)

Pretty sure master actually doesnt need the nodes stuff to be locked, and i think technically only slave 2 needs car 2 node locked, only slave 3 needs car 3 node locked etc but its properly easier just to lock all 7 across all machines if thats possible like it is in cheat engine. Anyway its a bit clunky over cheat engine so id love to make a quick cheat or something to do all this quickly but it works well once its done.

Ive only tested up to 3 players so far and it worked well, 3 started in position 38/40,39/40 and 40/40 and changed if we passed each other and dropped down as we passed AI cars (i got down to 16/40 after a few mins)

here is a horrible video of me doing it while holding my phone and trying to use cheat engine 1 handed between mouse/keyboard lol across both networked "machines" then driving a little on keyboard :P

« Last Edit: October 25, 2016, 02:08:05 am by Boomslang »

Howard_Casto

  • Idiot Police
  • Trade Count: (+1)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 19427
  • Last login:Yesterday at 12:48:28 pm
  • Your Post's Soul is MINE!!! .......Again??
    • The Dragon King
Re: Patching Daytona in m2emulator
« Reply #84 on: October 25, 2016, 11:52:42 am »
I don't know if this helps you, but you should be able to automate the process if you can find a value that is set once the race starts.  It doesn't really matter what the value is set to, so long as you can read it.  Then you can add the multiplayer init to a if/then statement and you are good to go. 

Boomslang

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 1063
  • Last login:January 01, 2024, 08:20:43 pm
  • I want to build my own arcade controls!
Re: Patching Daytona in m2emulator
« Reply #85 on: October 25, 2016, 05:05:10 pm »
Well if I don't lock RAMBASE+4008 then it changes the number slightly something like ****200 is when it's working normally otherwise it changes the last 3 digits to 180

However I can't then change it back to 200. It stays at 180 even if I try

Only way I found is if I locked it so it couldn't change

Does that make sense?

Howard_Casto

  • Idiot Police
  • Trade Count: (+1)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 19427
  • Last login:Yesterday at 12:48:28 pm
  • Your Post's Soul is MINE!!! .......Again??
    • The Dragon King
Re: Patching Daytona in m2emulator
« Reply #86 on: October 25, 2016, 10:43:36 pm »
Yeah but there are certainly other variables you can find.  For example something pumps out the 3,2,1 countdown.  Cheat engine is your friend on this one. 

Boomslang

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 1063
  • Last login:January 01, 2024, 08:20:43 pm
  • I want to build my own arcade controls!
Re: Patching Daytona in m2emulator
« Reply #87 on: October 25, 2016, 11:58:28 pm »
RAMBASE+1850 does the countdown
01 for 3
02 for 2
03 for 1
think it was 27 for go and then changes to 40 and remains on that

sits at 00 when starting race etc until the 3 count begins

Howard_Casto

  • Idiot Police
  • Trade Count: (+1)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 19427
  • Last login:Yesterday at 12:48:28 pm
  • Your Post's Soul is MINE!!! .......Again??
    • The Dragon King
Re: Patching Daytona in m2emulator
« Reply #88 on: October 26, 2016, 12:18:17 am »
Well that would probably work... you might have to include a delay. 

Boomslang

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 1063
  • Last login:January 01, 2024, 08:20:43 pm
  • I want to build my own arcade controls!
Re: Patching Daytona in m2emulator
« Reply #89 on: October 26, 2016, 12:55:38 am »
I don't really know how to do any scripting but would it be best to create a cheat and once turned on then when race begins it automatically runs the needed stuff
« Last Edit: October 26, 2016, 01:34:17 am by Boomslang »

Boomslang

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 1063
  • Last login:January 01, 2024, 08:20:43 pm
  • I want to build my own arcade controls!
Re: Patching Daytona in m2emulator
« Reply #90 on: October 26, 2016, 01:01:30 am »
When you aren't so busy then we can look at it. I can't code so ill get no where on it :)

Howard_Casto

  • Idiot Police
  • Trade Count: (+1)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 19427
  • Last login:Yesterday at 12:48:28 pm
  • Your Post's Soul is MINE!!! .......Again??
    • The Dragon King
Re: Patching Daytona in m2emulator
« Reply #91 on: October 26, 2016, 01:25:29 am »
yeah it should be doable.  I've got to set m2emulator back up first..... long story.

Boomslang

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 1063
  • Last login:January 01, 2024, 08:20:43 pm
  • I want to build my own arcade controls!
Re: Patching Daytona in m2emulator
« Reply #92 on: October 28, 2016, 03:12:27 am »
I mucked around for an hour today and got some VR lights going for a few other model 2 games today. Ill add it to this thread since I posted daytona one here too. Hopefully will tide someone over until Howard re-does everything for TS2 with m2 emulator 1.1a

lua files go in your m2 directory in scripts folder
ini files go in your ts2 directory in memcfg folder


indy500.lua
Code: [Select]
ROM = "indy500"
require("model2"); -- Import model2 machine globals

function Init()
os.execute ("tsstub.exe "..ROM)
end

function Frame()
I960_WriteDWord(0x005ec6b0,0x00000000)
end




srallyc.lua
Code: [Select]
ROM = "srallyc"
require("model2"); -- Import model2 machine globals

function Init()
os.execute ("tsstub.exe "..ROM)
end
function Frame()
Model2_SetWideScreen(1)
Model2_SetStretchALow(1)
Model2_SetStretchBLow(1)
Model2_SetStretchAHigh(1)
Model2_SetStretchBHigh(1)
end
function timecheatfunc(value)
I960_WriteWord(RAM2BASE+0xB0B0,99*60); -- 99 seconds always
end
function firstplacefunc(value)
I960_WriteWord(RAM2BASE+0x20C8,0); -- competitors in front
end
Options =
{
timecheat={name="Infinite Time",values={"Off","On"},runfunc=timecheatfunc},
firstplace={name="1st Place",values={"Off","On"},runfunc=firstplacefunc}
}





stcc.lua
Code: [Select]
ROM = "stcc"
require("model2"); -- Import model2 machine globals

function Init()
os.execute ("tsstub.exe "..ROM)
end




srallyc.ini
Code: [Select]
[Info]
Name=Sega Rally Championship
WinCaption=Sega Rally Championship
WinClass=MYWIN
ExeName=
ExePath=
LaunchGame=0
Enable=1
ExitMode=1

[Outputs]
Enable=1
EmuName=Model2
NumberOutputs=2

Output1PTR=||&H174CF0
Output1Type=byte
Output1BitMask=4
Output1Name=Start_Lamp

Output2PTR=||&H174CF0
Output2Type=byte
Output2BitMask=32
Output2Name=View1_Lamp




indy500.ini
Code: [Select]
[Info]
Name=Indianapolis 500 (Rev A, Twin, Newer rev)
WinCaption=Indianapolis 500 (Rev A, Twin, Newer rev)
WinClass=MYWIN
ExeName=
ExePath=
LaunchGame=0
Enable=1
ExitMode=1
[Inputs]

[Outputs]
Enable=1
EmuName=Model2
NumberOutputs=4

Output1PTR=||&H174CF0
Output1Type=byte
Output1BitMask=4
Output1Name=Start_Lamp

Output2PTR=||&H174CF0
Output2Type=byte
Output2BitMask=16
Output2Name=View1_Lamp

Output3PTR=||&H174CF0
Output3Type=byte
Output3BitMask=32
Output3Name=View2_Lamp

Output4PTR=||&H174CF0
Output4Type=byte
Output4BitMask=128
Output4Name=Leader_Lamp




stcc.ini
Code: [Select]
[Info]
Name=Sega Touring Car Championship
WinCaption=Sega Touring Car Championship
WinClass=MYWIN
ExeName=
ExePath=
LaunchGame=0
Enable=1
ExitMode=1

[Outputs]
Enable=1
EmuName=Model2
NumberOutputs=4

Output1PTR=||&H174CF0
Output1Type=byte
Output1BitMask=4
Output1Name=Start_Lamp

Output2PTR=||&H174CF0
Output2Type=byte
Output2BitMask=16
Output2Name=View1_Lamp

Output3PTR=||&H174CF0
Output3Type=byte
Output3BitMask=32
Output3Name=View2_Lamp

Output4PTR=||&H174CF0
Output4Type=byte
Output4BitMask=128
Output4Name=Leader_Lamp



« Last Edit: October 28, 2016, 03:17:00 am by Boomslang »

Howard_Casto

  • Idiot Police
  • Trade Count: (+1)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 19427
  • Last login:Yesterday at 12:48:28 pm
  • Your Post's Soul is MINE!!! .......Again??
    • The Dragon King
Re: Patching Daytona in m2emulator
« Reply #93 on: October 28, 2016, 07:23:04 pm »
Great work man.  I guess I'm going to have to start working on that pretty soon huh. 

to anyone wondering why I jump around so much...Sometimes when I can't sleep I'll muck around in cheat engine with a random game.  When I find something I need to implement it fairly quickly or my now swiss-cheese memory will forget about how I need to use the variables I found.  I've tried notes, but they are only partially effective. 

Anyway, I think what I've found in 2k6 is implemented enough to use, so a release will come soon. 

BigPanik

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 28
  • Last login:Yesterday at 05:57:21 pm
  • I want to build my own arcade controls!
Re: Patching Daytona in m2emulator
« Reply #94 on: August 31, 2020, 04:23:26 pm »
Back to the Daytona rom.

I try to get Special Edition output commands (Lamps, FFB and seat cylinders).
SailorSat has modify the Saturn add edition rom. How to patch the Special Edition? How to find the LDOB/STOB opcodes  to be modify?

Thanks

SailorSat

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 1238
  • Last login:Today at 06:58:15 pm
    • For Amusement Only e.V.
Re: Patching Daytona in m2emulator
« Reply #95 on: August 31, 2020, 05:54:53 pm »
Why not use the Saturn Ads version and set cabinet type to special? :)
I do all that stuff even without a Joystick ;)
Soft-15kHz, cabMAME, For Amusement Only e.V.


baritonomarchetto

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 822
  • Last login:July 05, 2025, 10:19:35 am
Re: Patching Daytona in m2emulator
« Reply #96 on: September 03, 2020, 02:17:54 am »
Great work man.  I guess I'm going to have to start working on that pretty soon huh. 

to anyone wondering why I jump around so much...Sometimes when I can't sleep I'll muck around in cheat engine with a random game.  When I find something I need to implement it fairly quickly or my now swiss-cheese memory will forget about how I need to use the variables I found.  I've tried notes, but they are only partially effective. 

Anyway, I think what I've found in 2k6 is implemented enough to use, so a release will come soon.
Am I welcome to suggest you the next game to toy with Howard? Atari Badlands. Why? It would be GREAT to be able to increase the number of laps :)
Looking at the bezel of my unit the original plan was to have 4 laps races, but the game ended to be released with only 3 laps...
(Sorry for the OT)
« Last Edit: September 03, 2020, 02:23:12 am by baritonomarchetto »

Howard_Casto

  • Idiot Police
  • Trade Count: (+1)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 19427
  • Last login:Yesterday at 12:48:28 pm
  • Your Post's Soul is MINE!!! .......Again??
    • The Dragon King
Re: Patching Daytona in m2emulator
« Reply #97 on: September 03, 2020, 01:26:21 pm »
You could probably do that with mame's built in cheat engine.  Altering something like the number of laps is pretty trivial. 

hammerheader

  • Trade Count: (0)
  • Jr. Member
  • **
  • Offline Offline
  • Posts: 1
  • Last login:October 19, 2020, 11:07:35 pm
  • I want to build my own arcade controls!
Re: Patching Daytona in m2emulator
« Reply #98 on: October 19, 2020, 11:07:35 pm »
I wonder what the heck ElSemi's been up to in these past six years. He seriously needs to open source this emulator, since that'd make patches like this much easier to make.