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
Site News

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


  

Author Topic: Sega Model 2 Emulator Full Screen Shooter fix - RamjetM2Borderless - App  (Read 51012 times)

0 Members and 1 Guest are viewing this topic.

RamjetR

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 144
    • My Youtube Channel
Hi all,

I've been building a couple of racing cabinets and a mame machine for use with the Model 2 Emulator and come across several well documented issues with regards to Shooting games and loss of fullscreen when reloading.

So I thought I'd have a crack at coming up with a fix and in mostly an afternoon, come up with not only a fix. But finely tuned it to be as seamless as possible to install and just fit into everyone's front end software.

This program will enable users to run their favourite lightgun shooters on Nebula's Model 2 Emulator and off screen reload without the program Alt-Tabbing or accidently minimizing to desktop.

Games (ROMS) supported

Virtua Cop 1
Virtua Cop 2
House of the Dead
Rail Chase 2
Gunblade NY
Behind Enemy Lines

As I'd accidently hijacked a thread of BadMouth's (forum.arcadecontrols.com/index.php?topic=104484.0;all), I have created this thread to give the application it's own place for discussion and possible stickiness for others to find easily for the future.

Here is my RamjetM2Borderless program (Current Version 0.7):

https://docs.google.com/open?id=0B-P3wlCiYEm3RzhCZk1NcFR3blE  <- Hosted at my Google Drive. Click File>Download

And here is the readme description:

Code: [Select]
Welcome to the - RamjetM2Borderless V0.7 -  support for Sega Model 2 Emulator.
--------------------------------------------------------------------------

This is a readme file on how to use this software

This program will enable users to run their favourite lightgun shooters on Nebula's Model 2 Emulator and off screen reload without the program Alt-Tabbing or
accidently minimizing to desktop.

Games (ROMS) supported
----------------------

Virtua Cop 1
Virtua Cop 2
House of the Dead
Rail Chase 2
Gunblade NY
Behind Enemy Lines



My Youtube Channel - please visit my youtube channel and make contact with me there.
-----------------------------------
http://www.youtube.com/user/ramjetr
-----------------------------------

or visit the active forum where this is currently being discussed

--------------------------------------------------------
http://forum.arcadecontrols.com/index.php?topic=104484.0
--------------------------------------------------------

Sega Model 2 Emulator can be found here

------------------------------
http://nebula.emulatronia.com/
------------------------------

---------------------------------------
Contents of RamjetM2Borderless V0.7.zip
---------------------------------------

RamjetM2Borderless.exe - The main program that monitors and sets borderless only the active Model 2 Emulator games below. Version number is removed for ease of LUA launching
gunbladeNY.ico - The following icons are loaded into the task bar when the game has been detected and running.
HOTD.ico
RailChase2.ico
Sega2.ico
VCop1.ico
behindenemylines.ico
\Scripts - LUA scripts to be ran by the Model2Emulator, This will automatically launch the RamjetM2Borderless program for you when the game is launched.
bel.lua
vcop.lua
vcop2.lua
hotd.lua
rchase2.lua
gunblade.lua




Installation
------------

Extract the contents of this zip file into the root folder of your model2 emulator.


What do I run? and What will this program do?
---------------------------------------------

*** Updated ***

In this release there is a slight change for the usage of this program since.

Now included in the Zip file is a \Scripts folder with LUA scripts which will be auto executed by M2 Emulator when the ROM is launched. Within the script, it calls a command window
and launches the RamjetM2Borderless.exe to run in background. Unfortunately the M2 Emulator LUA script cannot hide the cmd window, however it will only appear very briefly as the
RamjetM2Bordlerless program will actively close the cmd window for you in the background once it's executed.

When running with a Front End, hopefully you won't see any of this happening behind the scene. Depending on how the Front End handles the blanking of the screen between launching and
showing the emulator, your milage may vary.

You'll see a new little White/Blue Sega icon appear in your task bar next to the clock. This will change icon depending on which game is detected to be running

It will constantly scan for a one of the above games to run and then force the active title bar matching that name to run without a border. This will remove
the Min,Max,X buttons from the active window. Once running it will kill the cmd window that was opened by M2 Emulator and minimize.

This app will now auto close when Model2Emulator is closed. Since it's being launched directly by the Model 2 emulator via the LUA scripts, there is no need to manually start this
program.


Changelog;

V0.7 - Updated by Mark 'Ramjet' Gallon 11/7/2012
  Found solution to not autoclosing in WinXP in this forum thread. Many Thanks go to 'Serenity' for sharing his/her solution.
  http://www.autohotkey.com/community/viewtopic.php?t=35438
  Program should now actively close the M2Emulator cmd window in all Windows OS correctly now :)

V0.6 - Updated by Mark 'Ramjet' Gallon 10/7/2012
  Changed how RamjetM2Borderless detects and close's the M2emulator cmd window that is opened when the game ROM launches it. Previously used a Postmessage to close a
  particular cmd window (which was kinda cool and tricky), but may have had problems on WinXP? Took it back to basics and used WinWait to check for the cmd window and
  WinClose to close down the cmd window. Worked on my WinXP and Win7 machines. Visit the forum above to comment and give feedback.
 
V0.5 - Updated by Mark 'Ramjet' Gallon 6/7/2012
  Added LUA scripts to Autolaunch RamjetM2Borderless for all shooting games.
  Automated the cmd window closure from M2 Emulators LUA script which launched this program automatically.
  Automated the exit of this app when M2 Emulator is no longer running.
  Added right-click to the taskbar icons for an Exit and About information.
  General clean up of old test code which had become distracting.
     

V0.4 - Updated by Mark 'Ramjet' Gallon 3/7/2012
  Added support for Behind Enemy Lines with icon in tasktray

V0.3 - Updated By Mark 'Ramjet' Gallon 1/7/2012
  Since I didn't do a ReadMe for the first test program... here is the total changelog
  Code and test borderless concept - Working!
  Added more game support (see top of txt) with auto detection
  Created Icons for the task bar on game detect (for fun)
  Wrote this ReadMe.txt


Whats left to do;

Maximise/Window Detection to work correctly... I'll explain, I'm trying to detect when the game is full screen to remove border's and reapply them when back in a window mode
But it appears that the Model 2 Emulator doesn't set this flag correctly and hence it won't detect the transition from window to fullscreen. Working on that.... For now it
will remove the borders from the window with the active title bar that matches the name of the game and keeps them gone for as long as the progam is running.

Working on making sure that the correct window has it's borders removed... if you accidently remove the border from something (see bug below) alt-f4 and re-open it.

Known bug
---------

**** Update : The bug below may only occur if you've manually launched the program and it's running whilst your doing other things with your PC. If the program is launched by
M2Emulator as it should be with the scripts, then the active window should only be the emulator and exited automatically. The occurance of the below mentioned bug should be all
but practically eliminated. ****

It will sometimes detect a window with the same title as the game as being the game running. ie watch a youtube video of "Virtua Cop" and internet explorer changes its
title to that name and tricks my program into thinking it's running and removes the title bar. Took me ages to figure out why it was doing that! Turned out I was
watching a youtube video whilst writing the code. Anyway, it's a feature... not a fault :) And not a bloody thing I can do to stop it... and it should restore itself when the
program is Alt-F4'd (windows shortcut for close) and restarted. Don't panic, it's not the end of the world.


Thanks
------

Big Thanks go out to elsemi and all who've worked so hard to bring Model 2 Memories to the home. The Model 2 Emulator is the inspiration to all of us to create and develope and
restore the fond memories of a gaming era past.

Thankyou!

Ramjet :D

Big thanks to DarthMarino, ABACABB and Shun for helping me test it and giving feedback.

DarthMarino was ever so helpful in shooting and posting his video working on an early version of the program for your viewing pleasure.
 
Sega Model 2 Emulator Gun Games with AimTrak from ArcadeGuns.com


Please try out this app if your a shooter fan and love Model 2 games, I'd love to hear your feedback and comments or even just a simple thanks :)

If you feel like posting a video of your setup running full screen with this app below, I'd really appreciate seeing real results on real cabinets as I'm yet to buy my own set of guns and looking into who has the best experience with their gun solution.

So now that Model 2 Emulator work with your gun, there's no excuse not to play :)

Have a Great Day! and enjoy my app...
:D
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

Wade007

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 309
  • A MAME cabinet at home is heaven
    • bit.ly/1cWnoIC
    • Cheapskategamer.com
Very cool. Thanks so much. This is perfect timing. I'm just now gearing up to set up my lightgun games on all emulators including M2.

I downloaded your program and will give it a go.
Once I figure out how to install it (Read Me file right?) I'll post a comment on my results!!

Thanks again!!
My Super Arcade cabinet project:
Software blog article: http://bit.ly/1cWnoIC

Hardware blog article: http://bit.ly/1dWxjvP

YouTube video: http://bit.ly/1N818Xm

Super Arcade Cabinet Progress thread (Now Complete):
http://forum.arcadecontrols.com/index.php/topic,123292.0.html

Frontend Video Intro: http://bit.ly/1P9HPDN

Wade007

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 309
  • A MAME cabinet at home is heaven
    • bit.ly/1cWnoIC
    • Cheapskategamer.com
RamjetR,
Thanks again for the program. I have yet to hook my light guns back up to my cabinet CPU so I can't test out your program fully.

I will be using Arcade Guns. This was my review:
(http://www.cheapskategamer.com/pc_game_stories_and_news/true-light-gun-support-for-pc-gaming-the-arcade-guns%E2%84%A2-product-review/)

I wanted to post here to triple check that I installed your program correctly. Very excited to make sure it works!!!

I read the README file and unzipped the contents of the downloaded zip file into my root directory of Sega Model 2.
Therefore... in the same directory that holds my 'emulator_multicpu.exe' and 'emulator.exe', there is now a folder called "RamjetM2Borderless_V0.7".

Is that it???  ???

Do I need to copy and paste the .lua scripts (bel.lua, gunblade.lua, hotd.lua, rchase2.lua, vcop.lua, vcop2.lua) into the existing "scripts" folder of  M2? Or do they stay inside the RamJetM2Borderless_V0.7" scripts folder as they stand?

Please advise.

Thanks.

[EDIT]
OK, After reading through this thread I figured it out.
http://forum.arcadecontrols.com/index.php?topic=104484.40

I think I figured out how to install the program. You unzip the downloaded zipped file. All the contents inside the UNZIPPED folder go into the root directory of the M2 emulator except for the scripts. All the new .lua scripts in the newly unzipped "Scripts" folder are to be copied in the existing "Scripts" folder of the M2 emulator in the same directory. Uh...maybe update your README??

Sorry for being such a noob, but honestly it wasn't real clear in the README file. Especially for someone that isn't super familiar with how M2 works.

Now...after having gotten the program to work, I say "Brilliant Job RamjetR!!" I only tested using the default mouse-controlled reticule on the supported lightgun games, but it seemed to work great. And the program closed along with M2. Excellent!! Feels seamless.

As stated above, I have 2 Aim Trak based light guns from Arcade Guns.com. I will soon be hooking them up and running them through all the emulators I have loaded that support any lightgun games (MAME, M2, Supermodel 3, Demul, PC Ports). I'm very excited to use your program with M2. It definitely adds some solid functionality to the M2 emulator. Please...please keep me (us) updated here if there is a new updated release to your program. Excellent work!! Now if only we could get two lights guns to work at the same time (2 players) in M2.
« Last Edit: July 18, 2012, 01:31:39 am by Wade007 »
My Super Arcade cabinet project:
Software blog article: http://bit.ly/1cWnoIC

Hardware blog article: http://bit.ly/1dWxjvP

YouTube video: http://bit.ly/1N818Xm

Super Arcade Cabinet Progress thread (Now Complete):
http://forum.arcadecontrols.com/index.php/topic,123292.0.html

Frontend Video Intro: http://bit.ly/1P9HPDN

Aceisback

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 53
  • I want to build my own arcade controls!
I have been trying to get this fix working, but the borderless app does not load when I load a rom in M2. I have the app and ico files in the same directory as the M2 emulator exe files, and the lua files are in the scripts folder of the M2 directory. When I launch the emulator, the borderless exe is not executing. I can manually start the borderless exe file and then launch the M2 emulator and all is working. The borderless app even exits when I exit the M2 emulator. I am testing on Vista using the M2 ver 0.9 (can't get 1.0 to work, keeps crashing when I load a rom). I assume the scripts are working since the borderless app exits when I exit the emulator. I will be trying with a Win7 system soon, so not sure if it is Vista or an issue with the M2 emulator and script.

Any idea's? Hope this all makes sense.
Thanks!
Duane

RamjetR

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 144
    • My Youtube Channel
Re: Sega Model 2 Emulator Full Screen Shooter fix - RamjetM2Borderless - App
« Reply #4 on: September 04, 2012, 08:30:01 pm »
Hi, sorry for the late reply... I went in for surgery a couple weeks ago and been laying low recovering for a while... anyhow, to answer your question.

I haven't tried V0.9 since V1.0 of the emulator is running fine. My only suggestion is that in V0.9, the LUA script isn't being ran when the game is launched because LUA wasn't supported in V0.9 of the emulator. Hence the reason why it's not running.

Like you say, the borderless program can be launched manually and it will work on V0.9, but if you want it automatic start with the emulator (for use in a front end say) then you'll need V1.0 of the Model 2 Emulator.

I've never had any issue with the V1.0 of the emulator however? Some people report it crashes like crazy, but it's been rock solid for me and I run it on everything from a i7 920 with a ATI 5870 to a Core Duo with Nvidia 9600GT laptop...

So to sum it up.... V0.9 of the Emulator doesn't support the LUA scripts.... V1.0 does and will run the borderless program on ROM start. If you need to stick with V0.9 then you'll have to run the borderless program first. Just the way it works I'm afraid :)

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

mike boss

  • Trade Count: (+1)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 2557
Re: Sega Model 2 Emulator Full Screen Shooter fix - RamjetM2Borderless - App
« Reply #5 on: September 05, 2012, 07:31:00 am »
I'm in the process of completing my latest MAME PC.
I'm looking forward to giving this a shot.
I know people say great things about Model 2.
If I have the older version of Model 2 can I simply just drop in the newer version over top ?
(IE - dump the files into my existing folder replacing them ?)
I plan on using this with MaLa , I hope that isn't an issue.

Great work.

Thanks for sharing with us.
« Last Edit: September 05, 2012, 08:53:36 am by mike boss »

mike boss

  • Trade Count: (+1)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 2557
Re: Sega Model 2 Emulator Full Screen Shooter fix - RamjetM2Borderless - App
« Reply #6 on: September 05, 2012, 06:06:29 pm »
Don't have my guns installed (yet), however I did DL and install the program.
I see the icons near my clock so I guess its working the way it should !
Awesome stuff.

RamjetR

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 144
    • My Youtube Channel
Re: Sega Model 2 Emulator Full Screen Shooter fix - RamjetM2Borderless - App
« Reply #7 on: September 05, 2012, 10:22:18 pm »
Hi Mike,

yes you should be able to extract Model 2 emulator V1.0 over the top of previous versions...

My program will just extract into the root folder of your emulator and automatically should put everything in the right sub folders for you.

If you see a little white Sega Logo in the taskbar then the Borderless program is running and just waiting for a Shooter ROM to be loaded. Running a ROM in windowed mode you'll see the ICON change to match the ROM loaded. Otherwise if your in full screen, you'll probably never notice that happening.

I hope to see some youtube footage of your setup running nicely with my app :)

Note I'm still working (albeit slowely) on integrating Dual lightgun support into Model 2. But recently undergone surgery so, that may be a little longer than I hoped for...

Single Guns work great though now. :)
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

nipsmg

  • Trade Count: (+1)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 1331
  • ROONEY!! ERRGH!!
    • Arcadia
Re: Sega Model 2 Emulator Full Screen Shooter fix - RamjetM2Borderless - App
« Reply #8 on: September 05, 2012, 11:50:37 pm »
RamjetR,

Thanks for the work you've been doing on this.  I've been following it closely.  Get your rest and recover.  Dual lightguns in M2 would be epic.

Howard_Casto

  • Idiot Police
  • Trade Count: (+1)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 16758
  • Your Post's Soul is MINE!!! .......Again??
    • The Dragon King
Re: Sega Model 2 Emulator Full Screen Shooter fix - RamjetM2Borderless - App
« Reply #9 on: September 06, 2012, 12:53:20 am »
Good work as always. 

Now that I've had a chance to look into lua scripting a little more I think we should be able to add mame-style outputs to model 2, although I'm not familiar enough with lua's functions to do specific code.  The outputs should be in "IOBASE" and I've already hooked up some of them in mame, so we should just be able to pull the values from there. 

If os.execute is in there, I'm sure postmessage and copydata are in there as well, which is all that is needed.  If not we can use mamehooker's command line/dde support to pump the messages through. 

I noticed in the docs that lua supports polling the joystick.  If it can poll analog values then the script I'm currently working on for dual wii lightguns in mame can be modified to support model 2. 

Just some things to think about.... feel better.

mike boss

  • Trade Count: (+1)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 2557
Re: Sega Model 2 Emulator Full Screen Shooter fix - RamjetM2Borderless - App
« Reply #10 on: September 06, 2012, 07:30:21 am »
@ RamjetR

I DL'd the newer version of Model2 and simply replaced the contents of the folder with the new files. That all went perfect !

I wasn't able to DL your files from the above link (as a zip), but I did DL the indivual files.
Put the scripts in the scripts folder and the rest I simply left in the Model 2 folder.
I think that is correct ?

Either way, I launched a game from MaLa then minimized it to see the icon in the taskbar.

Now I just need to get my Aim Traks into my GunCon2 shells and really rock N roll !
I can't wait til the dual gun support comes out, that will be awesome.


Howard_Casto

  • Idiot Police
  • Trade Count: (+1)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 16758
  • Your Post's Soul is MINE!!! .......Again??
    • The Dragon King
Re: Sega Model 2 Emulator Full Screen Shooter fix - RamjetM2Borderless - App
« Reply #11 on: September 06, 2012, 09:30:58 am »
I thought I would dig up my notes (as well as the notes in mame) to see what I had on model 2 outputs.

They are generally in the range of 0x01c00008 - 0x01c0000b, with those three bytes being more than enough for bit-wize control.

Here are the ones that are specifically documented, but in general the address of the start lamps is universal and if the game has gun outputs, the solenoid follows right after:

--------------------------------------------------------------------------------------------
0x01c00008 - 0x01c0000b=Rail Chase 2 Outputs
==============================
0x00040000 = Start 1 lamp
0x00080000 = Start 2 lamp



0x01c00008 - 0x01c0000b = Sega Rally C outputs
==============================================
0x00040000 = Start 1 lamp
0x00200000 = vr lamp
0x00800000 = leader lamp
---------------------------------------------------------------------------------------------------

I'm going to try to find the outputs for gunblade and railchase because they are the easiest.  I know you've used memory tricks to simulate outputs for some of the racing games, but those are probably in there as well, it just might take a bit of data manipulation.

retrorepair

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 242
Re: Sega Model 2 Emulator Full Screen Shooter fix - RamjetM2Borderless - App
« Reply #12 on: September 06, 2012, 05:28:38 pm »
When me and ramjetr were looking through the emus memory we found some consistent activity when cycling lamps in the test menu but the same address was silent in game on all the racing games at least.

Never tried gunblade but it seems possible it's actually there for that game. Lamp data may not be exposed but a solenoid output may be in the same address as ffb which is.

I'd be mega interested to see what you find, especially since a gunblade related project is something I'll be looking at soon.

Howard_Casto

  • Idiot Police
  • Trade Count: (+1)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 16758
  • Your Post's Soul is MINE!!! .......Again??
    • The Dragon King
Re: Sega Model 2 Emulator Full Screen Shooter fix - RamjetM2Borderless - App
« Reply #13 on: September 06, 2012, 08:10:54 pm »
I've just started looking (spent about 20 min on it this morning) but thus far the outputs aren't where they are supposed to be, at least not in m2emulator they aren't.  If you can give me the addresses where you found activity then it would give me a starting point to work on it. 

In mame there's some psuedo encryption going on with model 2's i/o system.  The reason it isn't working in game is probably because sometimes you have to write a specific value when reading a specific value.  I think you can do that via lua, but I'm not sure.

retrorepair

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 242
Re: Sega Model 2 Emulator Full Screen Shooter fix - RamjetM2Borderless - App
« Reply #14 on: September 07, 2012, 06:08:13 am »
I wouldnt have expected that.

Lua can be locked down to various degrees (for commercial games for example to prevent cheating) but I'm fairly sure Elsemi left it wide open for m2emu so I think you can write to memory also.

I'll dig out the address if I still have a note of it. It was a while ago and I've had a hdd fall over since then. If I don't then ramjetr probably does.

Howard_Casto

  • Idiot Police
  • Trade Count: (+1)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 16758
  • Your Post's Soul is MINE!!! .......Again??
    • The Dragon King
Re: Sega Model 2 Emulator Full Screen Shooter fix - RamjetM2Borderless - App
« Reply #15 on: September 07, 2012, 08:15:16 am »
Well encryption is probably the wrong term.  I was just really tired when I posted that and I couldn't get my words out.  It's more like there is a missing driver board.  It's useless for our purposes, but the game waits for it to respond after sending data.  If there isn't a response then it stops sending data. 

retrorepair

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 242
Re: Sega Model 2 Emulator Full Screen Shooter fix - RamjetM2Borderless - App
« Reply #16 on: September 07, 2012, 08:23:38 am »
That's odd if ffb works. Doesnt m2emu require a drive board rom? It must be implimented somehow. I know the lamps on m2 are handled by an IC on the CPU board though not the drive board. It's as far as I know a general purpose I/O IC labeled 315-5649.

I would assume it'd probably handle solenoid outputs also via a solid state relay. Gunblade doesn't send out a signal for each "jolt" though, just a continuous on signal since the gun has a motor that just goes round and round rather than a solenoid. Just like alien 3.
« Last Edit: September 07, 2012, 08:28:35 am by retrorepair »

Howard_Casto

  • Idiot Police
  • Trade Count: (+1)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 16758
  • Your Post's Soul is MINE!!! .......Again??
    • The Dragon King
Re: Sega Model 2 Emulator Full Screen Shooter fix - RamjetM2Borderless - App
« Reply #17 on: September 07, 2012, 08:38:46 am »
Afaik it's not a full-fledged driver board (that as you said is a gp ic) but it's some "stuff" on the physical end of the game.  Like at the motors and ect....  I'm in no way certain though, I'm just guessing based on my other mis-adventures in hooking up terribly designed sega hardware.  ;)

I'm not referring to gunblade and the like, rather the racing games.  It is possible that the lamps would fail if there is a generic i/o error though.  Also sega is terrible about shifting the addresses.  The address for the outputs in deluxe cabinet mode might not be in the same location as they are in standard cabinet mode.  I know afterburner did that and it drove me crazy.

RamjetR

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 144
    • My Youtube Channel
Re: Sega Model 2 Emulator Full Screen Shooter fix - RamjetM2Borderless - App
« Reply #18 on: September 07, 2012, 08:38:41 pm »
Hi all :)

The memory addresses for all output/game conditions of all the games my VR program supports is available if you want them.

The IO PCB isn't emulated in the Sega Model 2 Emulator at all, or atleast if it is, it's not made accessible to users. I used CheatEngine and ArtMoney to find practically everything running in memory that is accessible to do with speed, acceleration, angle, steering, g-forces (which I assume the FFB is ran from by the emulator) etc.

From there I also gathered a mass of gamestate memory locations (which if not published took hours if not days of testing to discover reliably).

My output emulator VR thingy works but recreating the logical conditions from the ingame conditions that would normally be used to determine the outputs.

For example, I'd say;

If gamestate = 22 (ingame) and VRView = Yellow
Then enable output XX on PacDrive X etc etc

So essentially I monitored Hex code as it was running and reverse engineered what the game was doing to write a software equivalent of the IO PCB would have to do. It's all external to the emulator. And although I haven't done much to it for a month or so. It's pretty close to the real thing.

Monitoring the memory locations of the Service menu LAMP/Output test worked only when in service mode, and the locations it writes to in the emulator is met with a null location when monitored with CheatEngine or ArtMoney.

LUA does have OS.Execute, but using PostMessages is dependent on the version of LUA that was embedded. I've really found a lack of documentation of users writing Postmessages in LUA as most sample code online is for hacking WOW. The only reference I found to PostMessage in LUA was for a version of Girder, and at that time wasn't implemented into LUA.

I was meaning to contact you Howard in regards to getting AHK postmessages outputting to your Mamehooker correctly. Maybe a little co-dev here might speed things up a little and I'm learning higher level programming languages purely by having a go. I'm normally an assembly language programmer for microprocessors which is why I'm able to reverse engineer the Model 2 easier than writing the Windows equivalent higher language.

On a side note, yesterday I wrote a driver component to allow any AHK script to control and use those cheap LED name tags you get from novelty stores. I have mine at the moment updating Insert Coin/Credit/Running ROM information and planning to release a little utility to allow people to buy a $10 LED Name Tag and stick it on their cabinets for cool stuff... It's kinda funky.

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

RamjetR

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 144
    • My Youtube Channel
Re: Sega Model 2 Emulator Full Screen Shooter fix - RamjetM2Borderless - App
« Reply #19 on: September 07, 2012, 08:51:42 pm »
I wouldnt have expected that.

Lua can be locked down to various degrees (for commercial games for example to prevent cheating) but I'm fairly sure Elsemi left it wide open for m2emu so I think you can write to memory also.

I'll dig out the address if I still have a note of it. It was a while ago and I've had a hdd fall over since then. If I don't then ramjetr probably does.

For Dual lightguns,

You can write to memory. However, you don't really need LUA internally to do that. The Memory locations for position are stored locally in RAM as the Mice are read. The good news is that this can be externally injected into the memory of M2 emulator since there isn't any anti-cheating code of any kind.

This means that by writing an X/Y positioning location information directly into the memory location of M2, you should be able to take ANY pointing device from windows and just inject the X/Y locations into the game and map a trigger button.

If anyone would like to give me a hand on doing this and I'm being held up with windows programming and accessing HID devices (still learning) ... :)

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

Howard_Casto

  • Idiot Police
  • Trade Count: (+1)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 16758
  • Your Post's Soul is MINE!!! .......Again??
    • The Dragon King
Re: Sega Model 2 Emulator Full Screen Shooter fix - RamjetM2Borderless - App
« Reply #20 on: September 07, 2012, 09:00:39 pm »
Yeah we'll work on it.  What you've done is most impressive btw.... I've been following it, I've just been too busy to contribute.

I've been meaning to write an external dll that does the server-end of mame interop anyway.  Basically you would add it to any project and you would have the "SetOutputState" function that mame uses, which is ridiculously easy to use in code. 

My dll writing skills are virtually non-existant due to my preference to vb though (vb doesn't really do dlls) so it might take a while. 

I think unfortunately what Model2 is doing is over-writing the bytes that the outputs use.  They are inbetween the inputs, and also control other game functions, so the sloppy way to handle inputs is to just overwrite the whole area, which would kill the outputs.  I've also noticed other oddball stuff that the emulator does... like the proper i/o address for the guns x/y position as well as the trigger status is never accurate.  This leads me to believe that he simply bypassed the proper i/o position and just wrote directly to ram. 

I'm still interested in the addresses that you found actual lamp activity though.... I might be able to do some writes (which are apparently absent) in the io address which would jump start the outputs. 


Howard_Casto

  • Idiot Police
  • Trade Count: (+1)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 16758
  • Your Post's Soul is MINE!!! .......Again??
    • The Dragon King
Re: Sega Model 2 Emulator Full Screen Shooter fix - RamjetM2Borderless - App
« Reply #21 on: September 07, 2012, 09:08:54 pm »
For Dual lightguns,

You can write to memory. However, you don't really need LUA internally to do that. The Memory locations for position are stored locally in RAM as the Mice are read. The good news is that this can be externally injected into the memory of M2 emulator since there isn't any anti-cheating code of any kind.

This means that by writing an X/Y positioning location information directly into the memory location of M2, you should be able to take ANY pointing device from windows and just inject the X/Y locations into the game and map a trigger button.

If anyone would like to give me a hand on doing this and I'm being held up with windows programming and accessing HID devices (still learning) ... :)

Ramjet

Memory manipulation is fairly easy..... doing it without crashing things is the trick. ;)

I haven't used it much because for most applications, that borders on cracking and I like to do things in a cleaner way, but I can even do that stuff with vb.  I've already got tons of directinput code in my projects and one or two memory manipulation programs.  Just as a proof of concept, I can whip something up.... I just need the memory locations and the value format. 

If I wrote a simple program that allowed you to either map the x/y values to joystick axis or adjust them via keyboard keys that would probably be more than enough.  I can't think of anything that doesn't either show up as a joystick or keyboard aside from mice, which it already supports. 

**edit**  I've been meaning to do this anyway.  Via glovepie multiple wiimotes can pretty much only manipulate joysticks in vista/win 7 due to stupid secuirty additions.  So I was thinking of re-writing the "troubleshooter" for the old act-labs guns, only allow it to use joystick values as well.  There's an ini included with that app that has the memory addresses of pretty much all PC lightgun games.  Adding similar support for emulators would also be possible.
« Last Edit: September 07, 2012, 09:12:59 pm by Howard_Casto »

Howard_Casto

  • Idiot Police
  • Trade Count: (+1)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 16758
  • Your Post's Soul is MINE!!! .......Again??
    • The Dragon King
Re: Sega Model 2 Emulator Full Screen Shooter fix - RamjetM2Borderless - App
« Reply #22 on: September 08, 2012, 11:30:12 am »
Since you haven't replied yet, I thought I would give it a go. 

Tried out that ArtMoney program you mentioned.... I like it a lot better than the memory stuff I normally use... very quick!

Finding the gun axes took all of 20 min.

All values are a single byte:

P1 X Axis (0-255) =  0058f7b4
P1 Y Axis (255-0 Inverted) = 0058f7b6

P2 X Axis (0-255) = 0058f7b5
P2 Y Axis (255-0 Inverted) = 0058f7b7

I haven't tried this on every game yet, but I tried it on gunblade and hotd and they used different guns so it should be universal.
I couldn't find the trigger values, probably because they aren't all hacked up like the cross hair is, but it doesn't matter because model 2 uses P1 Button 1 and P2 Button 1 as triggers also, and they are redefinable in the emulator settings. 

When I get a chance I'll work on making a proof of concept app that'll edit these locations.

Howard_Casto

  • Idiot Police
  • Trade Count: (+1)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 16758
  • Your Post's Soul is MINE!!! .......Again??
    • The Dragon King
Re: Sega Model 2 Emulator Full Screen Shooter fix - RamjetM2Borderless - App
« Reply #23 on: September 08, 2012, 12:56:29 pm »
I successfully wrote a little test app that injects the memory values into model 2 for dual guns.

It works but I worry about performance on lesser systems.  Model2 constantly hammers the values with the mouse data, so likewise I have to constantly re-write them in an infinate loop.  It takes up about 25% of my processor on my system and I'm running a quad. 

It might be possible to hook these addresses, but I haven't looked into it yet.  Hooking is always dangerous in terms of crashes, so I'd like to avoid it. 

BadMouth

  • Trade Count: (+6)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 8415
  • ...
Re: Sega Model 2 Emulator Full Screen Shooter fix - RamjetM2Borderless - App
« Reply #24 on: September 08, 2012, 01:03:56 pm »
I successfully wrote a little test app that injects the memory values into model 2 for dual guns.

It works but I worry about performance on lesser systems.  Model2 constantly hammers the values with the mouse data, so likewise I have to constantly re-write them in an infinate loop.  It takes up about 25% of my processor on my system and I'm running a quad. 

It might be possible to hook these addresses, but I haven't looked into it yet.  Hooking is always dangerous in terms of crashes, so I'd like to avoid it.

Any chance you'll make a version for the old act labs CRT guns that only writes values once each trigger pull?

Howard_Casto

  • Idiot Police
  • Trade Count: (+1)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 16758
  • Your Post's Soul is MINE!!! .......Again??
    • The Dragon King
Re: Sega Model 2 Emulator Full Screen Shooter fix - RamjetM2Borderless - App
« Reply #25 on: September 08, 2012, 01:19:04 pm »
Probably, but you'd have to explain a bit more what you are talking about.

BadMouth

  • Trade Count: (+6)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 8415
  • ...
Re: Sega Model 2 Emulator Full Screen Shooter fix - RamjetM2Borderless - App
« Reply #26 on: September 08, 2012, 01:32:37 pm »
Probably, but you'd have to explain a bit more what you are talking about.

The old "true" light guns don't need to have mouse data constantly written because they only give their location when the trigger is pulled anyway.
The location just stays the same until the trigger is pulled again.
So an app specifically for them wouldn't need to put as much of an extra load on the processor.

I don't know how many people are still using the old CRT guns, but I still have them on my main setup.




Howard_Casto

  • Idiot Police
  • Trade Count: (+1)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 16758
  • Your Post's Soul is MINE!!! .......Again??
    • The Dragon King
Re: Sega Model 2 Emulator Full Screen Shooter fix - RamjetM2Borderless - App
« Reply #27 on: September 08, 2012, 02:07:07 pm »
Probably, but you'd have to explain a bit more what you are talking about.

The old "true" light guns don't need to have mouse data constantly written because they only give their location when the trigger is pulled anyway.
The location just stays the same until the trigger is pulled again.
So an app specifically for them wouldn't need to put as much of an extra load on the processor.

I don't know how many people are still using the old CRT guns, but I still have them on my main setup.

If I go a passive (non hooking) route then it would depend upon the game.  M2, as I've just mentioned constantly re-writes the cursor position... i'm sure many others do it that way as well.

RamjetR

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 144
    • My Youtube Channel
Re: Sega Model 2 Emulator Full Screen Shooter fix - RamjetM2Borderless - App
« Reply #28 on: September 08, 2012, 06:25:06 pm »
Heya,

sorry I didn't reply... Girlfriends Dad's 60th Birthday party... you know how it goes... "Put down that laptop and come and enjoy the party, your being rude!" .... so... yknow.

I've been rewriting the memory locations manually like you howard, but it doesn't update the cursors crosshair for me. Has that been a problem for you?

Badmouth is right to some degree that for most shooters, VCOP HOTD etc.... if you have a well calibrated gun (and service menu calibrated for 4:3 since widescreen calibration will offset a non stretched gamescreen cursor) the using the X/Y position on Trigger will work nicely.  However, Gunblade and others which are more "Joystick" crosshair type guns, then aligning a crosshair will be important.

How did you go with the offsets for you memory locations when you restart the emulator? I had trouble externally reconfiguring each time it launches which is why I was doing most of testing with LUA internally.

Girlfriend is having people over for lunch/dinner today so I'll be pretty much unable to do anything this weekend (This year has been super crazy busy... I reckon I've only had a couple weekends to myself all year!).

Will get my ArtMoney tables zipped up for you and send you a link. They're pretty much all you need for the major Racing titles.


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

Howard_Casto

  • Idiot Police
  • Trade Count: (+1)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 16758
  • Your Post's Soul is MINE!!! .......Again??
    • The Dragon King
Re: Sega Model 2 Emulator Full Screen Shooter fix - RamjetM2Borderless - App
« Reply #29 on: September 08, 2012, 06:58:44 pm »
Well which one are you talking about?  If you are talking about the fake one that the m2emulator uses no, it doesn't update that one.  But the one internal to the actual game updates, although it's a tad flickery because the position is constantly toggled back to the mouse pos via m2.  It's done inbetween frames, so your shots aren't off, but the flicker is bad.

In regards to the memory location, it's stored in two places... where the emulator reads it, which isn't static and where the game itself reads it, which is.  The values I posted above are the static ones... they should be the same every time you launch the emulator.  Or at least they are for me.   

The lua interface hasn't been particularly helpful for me... I think it's more locked out then we guessed because I can read some values via artmoney and they come up as an unchanging value via lua.  Same goes for writing.  It could be my inability to use the language properly though.  It would make a whole lot more sense to do it via lua as they could be injected at the start of the frame and hopefully the mouse wouldn't screw things up.

I've actually had much better luck with the joystick based games.  They use a simple 0-255, one byte value, so I can manipulate them easily.  I need to find the trigger byte though because apparently the second trigger for a lot of the games was never hooked up!  He's just using a straight hack to the mouse.

The true lightgun games are going to be a tad trickier.  They use a two byte positional value, which is OK, but there are all of these wierd offsets to contend with. 

Can model 2 save settings?  Because it would be a whole heck of a lot easier to go into the service menu, set the min/max values to something sensible and be done with it.

Howard_Casto

  • Idiot Police
  • Trade Count: (+1)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 16758
  • Your Post's Soul is MINE!!! .......Again??
    • The Dragon King
Re: Sega Model 2 Emulator Full Screen Shooter fix - RamjetM2Borderless - App
« Reply #30 on: September 08, 2012, 10:54:26 pm »
Somewhat related.... I pulled out the ini file for the old Troubleshooter application.   I plugged in the values that it had written down for house of the dead 3 and I could inject and manipulate them just fine!  So I'll go ahead and make a rudimentary troubleshooter replacement once I get time.  One that supports joysticks and keyboard keys as well as mice.  This is just something that's needed in this day and age as you can't manipulate multiple mice in windows anymore. 

I'll make it use the ini system and keep out any hardcoded values.  This way once we get further along with model 2 hacking it would simply take a few ini entries to support them. 

RamjetR

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 144
    • My Youtube Channel
Re: Sega Model 2 Emulator Full Screen Shooter fix - RamjetM2Borderless - App
« Reply #31 on: September 09, 2012, 06:30:54 pm »
I've never used Troubleshooter, probably because I still don't have any lightguns... I really must pick a couple up because it'll make it so much easier to test than to battle putting together a working dual wiimote connection.

So is troubleshooter externally configurable for just injecting into memory of other programs? I thought the games were hardcoded in the utility but that said, I haven't looked hard into troubleshooter. That would be a more suitable fix wouldn't it?

The memory locations I find with ArtMoney (especially in the racing roms) have static memory locations in the emulated ROM RAM. But the location changes when reading/writing externally to the emulator.exe. Which is the emulator.exe +(offset)... but for the life of me I couldn't get a readprocessmemory function of AHK to work. Which is why I'm doing an IO file write for my current version of the RamjetVR program.

I should add you on skype and have a chat about it sometime? 

LUA reading and writing is a bit tricky, especially when it comes to number formats other than word and Dword bytes. I can find some values for RPM, angle and other things like that which are a Float number format, but the LUA which is embedded into Model 2 Emulator doesn't seem to want to read float values correctly.

Model 2 will save it's service menu settings just fine,  a recalibration of whatever max/min values that are being injected is going to be needed regardless. On a side note, I did manage to get dual wiimote lightguns working with model 2 some time ago with PPJoy and joystick settings. It worked nicely, but for some reason I didn't write down what I'd done and have failed to replicate it. But I do know I was required to set the controls in the emulator to the joystick in the config.

I'll spend some time looking into the memory locations this week. If you want to share your artmoney table so that we're not doubling up on work that'd be great... I'll send you a PM.

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

Howard_Casto

  • Idiot Police
  • Trade Count: (+1)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 16758
  • Your Post's Soul is MINE!!! .......Again??
    • The Dragon King
Re: Sega Model 2 Emulator Full Screen Shooter fix - RamjetM2Borderless - App
« Reply #32 on: September 09, 2012, 11:57:33 pm »
I've never used Troubleshooter, probably because I still don't have any lightguns... I really must pick a couple up because it'll make it so much easier to test than to battle putting together a working dual wiimote connection.

So is troubleshooter externally configurable for just injecting into memory of other programs? I thought the games were hardcoded in the utility but that said, I haven't looked hard into troubleshooter. That would be a more suitable fix wouldn't it?

The memory locations I find with ArtMoney (especially in the racing roms) have static memory locations in the emulated ROM RAM. But the location changes when reading/writing externally to the emulator.exe. Which is the emulator.exe +(offset)... but for the life of me I couldn't get a readprocessmemory function of AHK to work. Which is why I'm doing an IO file write for my current version of the RamjetVR program.

I should add you on skype and have a chat about it sometime? 

LUA reading and writing is a bit tricky, especially when it comes to number formats other than word and Dword bytes. I can find some values for RPM, angle and other things like that which are a Float number format, but the LUA which is embedded into Model 2 Emulator doesn't seem to want to read float values correctly.

Model 2 will save it's service menu settings just fine,  a recalibration of whatever max/min values that are being injected is going to be needed regardless. On a side note, I did manage to get dual wiimote lightguns working with model 2 some time ago with PPJoy and joystick settings. It worked nicely, but for some reason I didn't write down what I'd done and have failed to replicate it. But I do know I was required to set the controls in the emulator to the joystick in the config.

I'll spend some time looking into the memory locations this week. If you want to share your artmoney table so that we're not doubling up on work that'd be great... I'll send you a PM.

Ramjet

Well troubleshooter was hardcoded AND configurable....  I'm not sure why he went to all the trouble of making up nice ini file if he was going to hardcode the gamelist, but oh well... we've got the memory locations and offsets for every pc lightgun game, so I can't complain.  Basically troubleshooter was created to fix pc games because never supported dual mice and various other issues.  You would get the game's controls to the keyboard (so the mouse wouldn't move things around) and it would inject the positional values into the games. 

The only problem was it was hardcoded to only support act-labs guns (the only ones out at the time) and only pointing devices that report an absolute position.  Also strangely enough on a few games that use the system mouse for the menu, like hotd3, he didn't hook the mouse, so you couldn't navigate menus properly. 

So if you are using a joystick-based lightgun, are using dual trackballs, or have a guncon, it didn't help you much. 


I doubt ahk scripts are going to work in this instance.  AHK is pretty powerful, but you are probably going to have issues with memory manipulation.  I know in other languages you can hook the pid of the exe and get your main offset that way.  That's how I'm doing it. 

I don't have skype unfortunately.  All kinds of IM services though. 

Dual joysticks would probably work on the pos-gun games, but I doubt that trick would work on the true lightgun games...... I'll give it a shot though.

RamjetR

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 144
    • My Youtube Channel
Re: Sega Model 2 Emulator Full Screen Shooter fix - RamjetM2Borderless - App
« Reply #33 on: September 11, 2012, 02:45:17 am »
Finally found 20mins to sit down with artmoney and look at VCOP

Found the same axis as you did, (need to grab another mouse to check P2) but also found the Reload for P1 @ 0x501698 = 00 - > 01= Reload P1, 02= Reload P2, 03= Both players Reloading
Also found the Start Button flashing outputs @ 0x50169C. 2 bytes = 12= P1 + P2 Start Flash, 08 = P2 Flashing, 04 = P1 Flashing, 00 for both players in game. So there is an output ppl can hook up.

P1 Axis has an input and output addresses... looks like it works the same as the other games where there is an input address range and the game makes copies in other area's of RAM as it's being used to update and be manipulated by the ROM.

Updating the source address will also update the others correctly, needing only one location to change.

Packing up to go home from work now... if I don't get distracted with the new BF3 DLC tonight, I may spend a little more time on it.

I'll forward you my Artmoney table tomorrow once it's a little more populated.

Ramjet
« Last Edit: September 11, 2012, 02:50:23 am by RamjetR »
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

Howard_Casto

  • Idiot Police
  • Trade Count: (+1)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 16758
  • Your Post's Soul is MINE!!! .......Again??
    • The Dragon King
Re: Sega Model 2 Emulator Full Screen Shooter fix - RamjetM2Borderless - App
« Reply #34 on: September 11, 2012, 09:48:54 am »
Either I've plugged em in wrong, or you found some of those dynamic addresses.  I've found those as well.... when you reload model 2 they aren't the same. 

We might have better luck in lua, I dunno. 

*update*

Hmm they do work within lua though. 

I'm curious, how did you manage to find them in artmoney if it gives a different address?

Anyway, we can still work with that.  As you know, lua has a getramptr function.... we can write that to a file and let external programs pick it up and manipulate accordingly.
« Last Edit: September 11, 2012, 10:00:50 am by Howard_Casto »

theonegoku

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 25
  • I want to build my own arcade controls!
Re: Sega Model 2 Emulator Full Screen Shooter fix - RamjetM2Borderless - App
« Reply #35 on: September 11, 2012, 10:11:03 am »
I've never used Troubleshooter, probably because I still don't have any lightguns... I really must pick a couple up because it'll make it so much easier to test than to battle putting together a working dual wiimote connection.

So is troubleshooter externally configurable for just injecting into memory of other programs? I thought the games were hardcoded in the utility but that said, I haven't looked hard into troubleshooter. That would be a more suitable fix wouldn't it?

The memory locations I find with ArtMoney (especially in the racing roms) have static memory locations in the emulated ROM RAM. But the location changes when reading/writing externally to the emulator.exe. Which is the emulator.exe +(offset)... but for the life of me I couldn't get a readprocessmemory function of AHK to work. Which is why I'm doing an IO file write for my current version of the RamjetVR program.

I should add you on skype and have a chat about it sometime? 

LUA reading and writing is a bit tricky, especially when it comes to number formats other than word and Dword bytes. I can find some values for RPM, angle and other things like that which are a Float number format, but the LUA which is embedded into Model 2 Emulator doesn't seem to want to read float values correctly.

Model 2 will save it's service menu settings just fine,  a recalibration of whatever max/min values that are being injected is going to be needed regardless. On a side note, I did manage to get dual wiimote lightguns working with model 2 some time ago with PPJoy and joystick settings. It worked nicely, but for some reason I didn't write down what I'd done and have failed to replicate it. But I do know I was required to set the controls in the emulator to the joystick in the config.

I'll spend some time looking into the memory locations this week. If you want to share your artmoney table so that we're not doubling up on work that'd be great... I'll send you a PM.

Ramjet

Well troubleshooter was hardcoded AND configurable....  I'm not sure why he went to all the trouble of making up nice ini file if he was going to hardcode the gamelist, but oh well... we've got the memory locations and offsets for every pc lightgun game, so I can't complain.  Basically troubleshooter was created to fix pc games because never supported dual mice and various other issues.  You would get the game's controls to the keyboard (so the mouse wouldn't move things around) and it would inject the positional values into the games. 

The only problem was it was hardcoded to only support act-labs guns (the only ones out at the time) and only pointing devices that report an absolute position.  Also strangely enough on a few games that use the system mouse for the menu, like hotd3, he didn't hook the mouse, so you couldn't navigate menus properly. 

So if you are using a joystick-based lightgun, are using dual trackballs, or have a guncon, it didn't help you much. 


I doubt ahk scripts are going to work in this instance.  AHK is pretty powerful, but you are probably going to have issues with memory manipulation.  I know in other languages you can hook the pid of the exe and get your main offset that way.  That's how I'm doing it. 

I don't have skype unfortunately.  All kinds of IM services though. 

Dual joysticks would probably work on the pos-gun games, but I doubt that trick would work on the true lightgun games...... I'll give it a shot though.

Are you referring to the first version of Troubleshooter when it first came out? or the current version.  On the current version it does have some problems, stemming from the fact that you have to set your lightguns to "keyboard" instead of "mouse or lightgun" in games like HOTD3, like having to choose what path u want to take and pressing enter on the keyboard instead with the trigger.  But aside from that, I am able to navigate the menu screens with the mouse/lightgun with no problem.  I know it was made for act labs but it works just fine with other lightguns I have tried.  I am currently at work, but have a pic on my facebook of me using it with my new EMS Topgun 3 that I can attach real quick.

Howard_Casto

  • Idiot Police
  • Trade Count: (+1)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 16758
  • Your Post's Soul is MINE!!! .......Again??
    • The Dragon King
Re: Sega Model 2 Emulator Full Screen Shooter fix - RamjetM2Borderless - App
« Reply #36 on: September 11, 2012, 11:16:29 am »
Some of the lightguns out there behave like the actlabs guns and they work, others do not. 

Yeah that's what I'm talking about in hotd3... there's no reason to do it that way.  I've found that in most games you can easily manipulate the system mouse.  So the best way to do it imho would be to have the user set p1 to use the mouse and have the troubleshooter read the raw mouse values and inject them.  It won't work for every game, but it should work for hotd3. 

theonegoku

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 25
  • I want to build my own arcade controls!
Re: Sega Model 2 Emulator Full Screen Shooter fix - RamjetM2Borderless - App
« Reply #37 on: September 11, 2012, 11:24:02 am »
Some of the lightguns out there behave like the actlabs guns and they work, others do not. 

Yeah that's what I'm talking about in hotd3... there's no reason to do it that way.  I've found that in most games you can easily manipulate the system mouse.  So the best way to do it imho would be to have the user set p1 to use the mouse and have the troubleshooter read the raw mouse values and inject them.  It won't work for every game, but it should work for hotd3.

Definitly agree, but luckily when its all in the cab, the cp will be right in front of me to simply hit the button, but when its on the keyboard it gets tedious for sure.  But anything is better than watching the crosshair jump around constantly until the trigger is pulled ;)

Howard_Casto

  • Idiot Police
  • Trade Count: (+1)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 16758
  • Your Post's Soul is MINE!!! .......Again??
    • The Dragon King
Re: Sega Model 2 Emulator Full Screen Shooter fix - RamjetM2Borderless - App
« Reply #38 on: September 11, 2012, 02:44:26 pm »
Found another set of outputs.... these are external (artmoney) addresses though.  This might be why some of the games (daytona ect..) don't have accessable outputs.  I looked up the accessable addresses in model2 via the ramptr function and this address is over 0x100000 bytes below the lowest addressable section. 

0x559CA4 is the lamp outputs for HOTD

This address also seems to be the output address for gunblade, as well as the gun recoil, but it uses slightly different bit-shifting, so I'll have to figure out the individual outputs.

***Edit****

Looks like typical  SEGA bit-shifting.

So (as viewed as an integer and NOT a bit mask):

output 1 = +4
output 2 = +8
output 3 = +16
output 4 = +32
output 5 = +64
output 6 = +128

As a BitMask it looks like this

00123456

With the number representing the output number


This is pretty standard sega stuff... it just looks like the addresses were hidden from the lua scripting.
For some reason sega always ignores the first two bits (int +1 and int +2)
« Last Edit: September 11, 2012, 02:51:22 pm by Howard_Casto »

Howard_Casto

  • Idiot Police
  • Trade Count: (+1)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 16758
  • Your Post's Soul is MINE!!! .......Again??
    • The Dragon King
Re: Sega Model 2 Emulator Full Screen Shooter fix - RamjetM2Borderless - App
« Reply #39 on: September 11, 2012, 02:59:59 pm »
Looks like VCOP2 uses the same address as well.... it would have been hard to find though because for whatever reason bits 1 and 2 are always set on that game, so you subtract three to the integer values

I hate to keep updating, but I'm bad about losing my files, so it's best to post.

Rail Chase 2 uses the same address as well.  The motion chair bytes are a few bytes over, but it's all bunkered without the I/O board anyway so there isn't any reason to investigate it. 

Behind enemy lines still eludes me, as it uses a different address, but it appears to use the same i/o system as daytona and the racers only it's much simpler due to the lack of outputs.  So if we can find it's address the true addresses for daytona and the like are most likely in the same place.
« Last Edit: September 11, 2012, 03:26:06 pm by Howard_Casto »

RamjetR

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 144
    • My Youtube Channel
Re: Sega Model 2 Emulator Full Screen Shooter fix - RamjetM2Borderless - App
« Reply #40 on: September 11, 2012, 06:52:18 pm »
Either I've plugged em in wrong, or you found some of those dynamic addresses.  I've found those as well.... when you reload model 2 they aren't the same. 

I'm curious, how did you manage to find them in artmoney if it gives a different address?

Anyway, we can still work with that.  As you know, lua has a getramptr function.... we can write that to a file and let external programs pick it up and manipulate accordingly.

Blimey you were busy overnight lol.

The addresses I found work every time with artmoney... I have Getramptr exporting to a file now. But it's almost just as easy also put in the addresses for anything else you want to monitor or change. I'll be updating my RamjetVR program to do this rather than manually exporting data to a file and reading it externally constantly (although there was little to no overhead on doing that, but it hammers the HDD if windows commits the file to the disk which I struggle to prove if it yet does actually write the file)

Ok, how Sega seems to write their program structures is with offsets from the primary group of values. ummm trying to explain this properly, for the example of the values in VCOP, here's the process of what I did to find them.

1 - With VCOP running and Artmoney open.
2 - Entered the Service Menu of VCOP and went to Gun Calibration
3 - Did a calibration and it displays the number for the min and max area's hit by the gun shooting at the cal points. I think it was b5 and 4c7 or something like that.
4 - Did a RAM search on the calibrated values in RAM which would get me to the area where the gun calibration is being performed.
5 - Added the first value which looks "about" right and right clicked to monitor memory address area.
6 - Adjust RAM Refresh rate to 20ms so that the memory updates are reasonably close to real time for me to watch them.
7 - To find the P1 axis, I just moved the mouse and watched the memory locations around that area for +/- change and stopping when I moved the mouse. Noting that the original address didn't change because it was the committed calibration value and not the actual mouse locations. I knew I was close, so when watching I noticed a slight delay on which locations were getting an X and Y update first, because as you know there are several copies of the XY in memory. The one that updates first was the one receiving the original mouse input. Once that was spotted easily, lock in the P1 Axis locations.
8 - I exit out of service menu and went to the game and threw in a couple credits and started the game....
9 - Monitoring the memory area I noticed several patterns in addition to the mouse movement... Watch for toggling memory locations, values that change to different numbers and return again in a pattern.
10- Noticed a Value changing from 12 to 00 and back again in time with the Start button flashing. I started player 1 and the values changed... started player 2 and it went to 00.... let it go back to the beginning where P1 and P2 can press start and it returned to 0C.... Lock in the Player start flashing output.... memory found.
11- Remember I'm monitoring memory as it's running live here as it's often easier to spot a pattern than it is to pause and go looking for what is most of the time unknown values. So I started Right Clicking (Reload) and noticed a memory toggling in time with my finger pressing. Grabbed a second mouse and noted the value changed from 00 - 01 - 02 - 03 depending on which player or both we're asking for a reload.
12- As I'm monitoring memory locations I then also start collecting patterns of memory addresses that change and repeat when the game screen changes, ie Attract, player start, game select, mode select, car select, Single player Race or Multiplayer race (as the values can be difference in the same location if it's talking to other cabinets) etc etc...

It's more of a skill of knowing what to look for rather than knowing what value to look for and knowing the difference between what is original source data and how it copies it to use elsewhere in the game for other calculations.

I'd also use CheatEngine for digging deeper into dynamic memory as you can give it a memory location 0x50blahblahblah for example, and ask it to monitor what other memory/process will access that memory location... so if you've found a copy and it changes each time in memory, then you can find out what is addressing that location and often that will provide you with the structure base address offset. Allowing you to go back in memory to find the original data.

When Sega programmed these back in the day, it was all assembly language (which I do today for microprocessors). So with Cheat engine, you can dissassemble the running code and look up the opcodes from the CPU and see what all the CPU registries and stack information is doing at that time, what is being done to the code and where it is placing it after the opcode is executed.

If only I knew windows programming as well as I do assembly language lol!

 
« Last Edit: September 11, 2012, 07:21:22 pm by RamjetR »
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

Howard_Casto

  • Idiot Police
  • Trade Count: (+1)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 16758
  • Your Post's Soul is MINE!!! .......Again??
    • The Dragon King
Re: Sega Model 2 Emulator Full Screen Shooter fix - RamjetM2Borderless - App
« Reply #41 on: September 11, 2012, 07:28:28 pm »
Well that's essentially how I do it, but I'm wondering how you actually found those values. 

I've found the memory monitor to be fairly useless because it's so darn hard to navigate.  It's great if you the address is a few bytes here or there from where you start it, but if it's a ways off it can be daunting to find it.

I know a *little* assembly... probably just enough to get me into trouble. 

Howard_Casto

  • Idiot Police
  • Trade Count: (+1)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 16758
  • Your Post's Soul is MINE!!! .......Again??
    • The Dragon King
Re: Sega Model 2 Emulator Full Screen Shooter fix - RamjetM2Borderless - App
« Reply #42 on: September 12, 2012, 10:43:56 am »
I realized something last night and I think I know why you are saying that the address you found is statice and I'm saying its dynamic.  You are using the Model 2 helper functions built into art money aren't you.   Those automatically translate the dynamic addresses to static ones relative to the emulator. 

I haven't been using those because it seems like an external program is the way to go.  Lua doesn't have all the tools we need... or at least I can't find enough documentation for lua to know if it has all the tools we need.  ;)

retrorepair

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 242
Re: Sega Model 2 Emulator Full Screen Shooter fix - RamjetM2Borderless - App
« Reply #43 on: September 12, 2012, 05:17:04 pm »
Hold up, so does this mean lua can actually see the output addresses even if it can't do the math to decode them?

I think it probably is possible in lua but being able to read from those is the main thing right? Once you have those you can get an external program to do the decoding. For things like lamps and recoil you'd need an external program anyway and though I hate to add another thing to mamehookers to do list it seems a pretty logical choice.

Great work all round by the way.

Howard_Casto

  • Idiot Police
  • Trade Count: (+1)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 16758
  • Your Post's Soul is MINE!!! .......Again??
    • The Dragon King
Re: Sega Model 2 Emulator Full Screen Shooter fix - RamjetM2Borderless - App
« Reply #44 on: September 12, 2012, 06:31:36 pm »
Not exactly....

It's like this: 

Model2 emulator specifically has some functions written to read the virtual memory addresses of the roms of the game loaded into the emulator.  Because of this we can read the memory of the running game.  But there aren't any functions for anything else, so we can't for example read the memory of the actual emulator program. 

The memory hacking program we are using has some utilites to read things like the lua script does.... basically it takes the address of the emulator.exe in memory and adds an offset. Which works just fine as long as a new version of the emulator doesn't come out.

So we have some things in the emulators memory that we need to address (like mouse position ect) that we CAN'T get from lua, and some things like the value of variable in the game, which we can.  And then we have things like the game outputs, which we can't get to via lua even though we should be able to because those areas of the game's rom weren't properly mapped. 

Long story short, most values are external to model 2 and we can just directly access them.  A few are found via a emulator offset (aka the lua scripting) but lua will output the real address and has the option to write it to file, so we are good either way.

As for mamehooker, I'm taking a different route.... stay tuned on that.

RamjetR

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 144
    • My Youtube Channel
Re: Sega Model 2 Emulator Full Screen Shooter fix - RamjetM2Borderless - App
« Reply #45 on: September 13, 2012, 10:09:33 pm »
Hi Howard,

Yes, thats exactly what I'm using. Since everything in Model 2 "world" is happening in it's own virtualized RAM 0x50000 onwards, there seemed little issue using the automatic emulator profiles for artmoney. This was preferable infact as when operating in LUA, the 0x5xxxx values are always consistant and can be exported using the (getrampointer)+(memorylocation offset). Static memory locations every time :)

@Retro
LUA is running underneath the emulator as as such has only been given access to specific area's of the virtualized memory. Namely RAM and some ROM areas. I/O's in the PCB is an actual physical port number and aren't actually emulated rather than where inputs need to be gathered, are manually injected by the emulator into the running process and the OPcodes the CPU is calling for I/O is being intercepted by the emulator and fed with the information it needs since the I/O ports don't actually exist. If that makes sense?

The conditions that the game use to send the ports are however in RAM as they are generated from the running of the ROM dynamically and are somewhere waiting in code to be sent to the IO port. That part we can read. The recent break though is in seeing where the inputs are being handled in RAM and it coincides with where the outputs also appear to be handled. So atleast we're getting closer to actual real outputs rather than writing elaborate code to emulate what the output would be given the inputs available.

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

retrorepair

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 242
Re: Sega Model 2 Emulator Full Screen Shooter fix - RamjetM2Borderless - App
« Reply #46 on: December 08, 2012, 01:41:35 am »
Ok, so since I'm quite ill and can't really gather the energy to do anything physical I figured I'd have a look at gunblade and see if I could find some I/O to tap into.

I found a bit more than that, near as I can tell, every game has it's I/O totally exposed EXCEPT Daytona  ::) Pretty certain now there's no way to access the outputs for this which is odd since VCOP has them. Maybe it was all handled on the drive board which is fudged somehow?

I've attached several files from what I've managed to work out, just a few for now. Both artmoney tables with memory locations and lua scripts to demonstrate the value's function.

Sega Rally - Wasn't hard, there's only 3 :)
Indy500 - Wasn't hard to find but took a while to map out which value does what
STCC - Likewise. Memory locations are different but values are identical to Indy500
Gunblade - Outputs are there as well as recoil and analog inputs :) Would be nice to know what to do with the analog inputs though. Can't believe ElSemi only allowed mouse input for an analog joystick game  ::) Read the lua for explainations on this one

How we missed all of these when we were working on the VR app I've no idea but here they are, so no more messing around "faking" it with most of them at least.

RamjetR

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 144
    • My Youtube Channel
Re: Sega Model 2 Emulator Full Screen Shooter fix - RamjetM2Borderless - App
« Reply #47 on: December 18, 2012, 05:06:54 pm »
I know how we missed them.... primary work was spent on and almost exclusive to Daytona USA. It was then just assumed that others were the same once we were looking for the same virtual memory conditions as what we got from Daytona.

That said, some of those scripts don't appear to work for me? Had a quick look yesterday at them and STCC for example seems to map the bios outputs ok, but once in game the memory location is invalid and not updated?

All the Shooter games have their outputs easily mapped but I reckon this is due to the revision of the hardware that ran all the shooter games being similar. Whilst the Drivers are slightly different.

I have some time of over the christmas holidays to look into finishing off the bits and pieces of code I've had little time to work on this year.

Ramjet
« Last Edit: December 18, 2012, 05:18:36 pm by RamjetR »
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

retrorepair

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 242
Re: Sega Model 2 Emulator Full Screen Shooter fix - RamjetM2Borderless - App
« Reply #48 on: December 24, 2012, 09:29:25 am »
Not sure how but that artmoney file has the wrong address for STCC, it should be 0020B214. Remember with STCC also (as with many or all M2 games) the start lamp only flashes when the game is set to freeplay or it's coined up and leader lamps only work when networked (except indy500).

No idea if different regions/revisions change things but I'd say it's unlikely in most cases.

For some reason on STCC, the start lamp, rev limit and leader lamps all work in game but the VR zoom lamps don't. I can confirm they didn't on my real twin setup either (original hardware) which is odd. As with the emulator, they worked fine in the test menu. Setting the thing to DX didn't help, I assume it was either rushed out so quickly they didn't hook them up for in game or there's an option in the test menu that needs to be set which I've not found.

As for Daytona, it seems Howard's theory about XOR type tables could well apply to that one game. Virtua Racing in MAME is the same (apparently the outputs are XOR'd together in 16 byte blocks) and considering the similarities between VR and Daytona hardware that's more than likely the case. This is way over my head though. Here's the thread, there's some pretty interesting info on networking here too: MAME World Thread

I also think rather than calling the pacdrive dll directly it'd be best to interface outputs to mame hooker for the sake of keeping things universal as in support for other devices etc. There is an AHK library for DDE but I couldn't get it to work just yet. If it could be gotten to work though it'd be a piece of cake. Just a shame DDE can't be used in Lua (that I've found anyway).

As inefficient as it may be it seems the only real way to communicate with another app from Lua is through writing to a text file (it'll only write to it when a state changes anyway so it's not the end of the world) so for this special case it'd be useful if MH could read outputs from a text file. It'd certainly save having to run another intermediate program as well as having to drop in a lua file.
« Last Edit: December 24, 2012, 09:42:17 am by retrorepair »

retrorepair

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 242
Re: Sega Model 2 Emulator Full Screen Shooter fix - RamjetM2Borderless - App
« Reply #49 on: December 24, 2012, 09:46:18 am »
Oh yeah, if you add this line to m2network.ini on each machine:

Code: [Select]
FrameSync=1
network works 100% apparently. You still need gigabit ethernet. Would have been nice if that was documented someplace (knowing me I just missed it in the M2emu docs but I don't think I did).
« Last Edit: December 24, 2012, 09:52:22 am by retrorepair »

Howard_Casto

  • Idiot Police
  • Trade Count: (+1)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 16758
  • Your Post's Soul is MINE!!! .......Again??
    • The Dragon King
Re: Sega Model 2 Emulator Full Screen Shooter fix - RamjetM2Borderless - App
« Reply #50 on: December 25, 2012, 03:12:58 am »
Hey guys, Merry Christmas!

Just got done with a session of NSMB U so I thought I'd chime in for a sec. 

Didn't get nearly as much done as I wanted unfortunately... last minute gifts/headaches and a mild cold kept my head out of the game last week.  I should have plenty of time this coming week though, so I'll get mamehooker out and go from there. 

DDE is crazy annoying to code for.  In most languages it flat out won't work unless your code is compiled, so while a ahk script probably won't do anything, a ahk exe will.  There are other options available in the next release though, so just sit tight. 

ArtMoney has different "modes" basically relative to the exe address in memory and absolute. 


We'll figure it out, just be patient. 

RamjetR

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 144
    • My Youtube Channel
Re: Sega Model 2 Emulator Full Screen Shooter fix - RamjetM2Borderless - App
« Reply #51 on: January 01, 2013, 04:03:21 pm »
A bit belated but Merry Christmas and Happy New Year! I haven't done much at all either over the christmas period. A new nephew arrived, and the 2yro niece (who just loves me like a best friend) won't leave my side the whole time. So I've been doing alot of baby sitting, BF3ing (where I can) and Arduino tinkering. Did you know that a clever little New Zealand man called Darran has released some code and hack for arduino to make it report USB compliant HID code? Make your own Mouse/Joystick anyone? Relatively simple to do and with a bit more buggering around perhaps it can be my very own LED output controller too? I get distracted easily... and I know you all know what I mean by that!

Retro, the real STCC DX cabinet I have in the garage now will actually work the VR Lamps up and down whilst in game. It flashes Red Blue according to the upper and lower views selected. I copied the actual sequence for the last version of the VR program. If there are games that don't output all of the IO's from the same address, and can't be found elsewhere... then the emulation we have is likely sufficient enough. I can speed up this process significantly now (that I've learned a bit more coding). Real IO information would make things simpler, but if it can't then 99% of all other features can be derived from game conditions.

Thanks for the tip on the Framesync, I'll try that a bit later as in true fashion the girlfriend is dragging me out and about. probably to baby sit and maybe buy a new TV? ... Maybe....

Haven't a clue what DDE is btw... arrgh ok, gotta go. Back laters.

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

BadMouth

  • Trade Count: (+6)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 8415
  • ...
Re: Sega Model 2 Emulator Full Screen Shooter fix - RamjetM2Borderless - App
« Reply #52 on: January 11, 2013, 09:16:54 am »
In case you guys don't see this in the Main forum:
http://forum.arcadecontrols.com/index.php/topic,104484.msg1326289.html#msg1326289

Someone claims to have 2 wii controllers working in M2Emulator using Howard's Glovepie scripts.

I tried to get joysticks(positional guns) working with every older version of M2Emulator that I could find, but had no success.
I'm thinking M2Emulator is picking up rawinput from somewhere other than the final virtual gamepad in the chain,
but I'm nowhere near as knowledgeable about any of the software involved as you guys are.

Howard_Casto

  • Idiot Police
  • Trade Count: (+1)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 16758
  • Your Post's Soul is MINE!!! .......Again??
    • The Dragon King
Re: Sega Model 2 Emulator Full Screen Shooter fix - RamjetM2Borderless - App
« Reply #53 on: January 11, 2013, 04:13:08 pm »
Let's put it this way... if that worked I'd be really really suprised. 

My scripts turn the wiimotes into joysticks, they don't show up as mice... also they are scripted to pretty much only work in mame.  They actually go intert if you try to use them in other games other than a visual indicator (which I guess could move the cursor). 

I actually made some scripts prior to the method we are working on now.  I could get the p2 cursor to move, but it would constantly snap back to the default position.  So the games were quite playable, but because of that snap back you'd get gunfire randomly in the wrong place, so it would kill your accuracy score.  Maybe that's the issue he's referring to?

vandale

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 318
  • Id 10 and t error
Re: Sega Model 2 Emulator Full Screen Shooter fix - RamjetM2Borderless - App
« Reply #54 on: January 12, 2013, 05:30:26 am »
Hi, the post about 2 wiimotes working in M2 was me :) I can assure you the script I mentioned in the other post works in M2, both players, same time with correct trigger and reloading button assignments.

No I am not getting snap back that you mention.

The issue I have is the cross hair doesnt track with the wiimote movement, i have to over compensate to get the cross hair moving in the direction I need. Same script in MAME and the cross hair tracks perfect. Also another weird scenario in M2 that i dont get in mame is P1's trigger button works but if I keep it held down it then auto fires at an incredible rate and auto reloads as well?

Its an awesome script. My wiimotes auto connect anytime I want and stay calibrated. I use them in Model 3 Jurassic park also no issues.

Its M2 that I really want working, HOTD and Virtua Cop!

I can put up a video of this if you want?

Howard_Casto

  • Idiot Police
  • Trade Count: (+1)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 16758
  • Your Post's Soul is MINE!!! .......Again??
    • The Dragon King
Re: Sega Model 2 Emulator Full Screen Shooter fix - RamjetM2Borderless - App
« Reply #55 on: January 12, 2013, 05:06:15 pm »
It would, so I can undestand exactly what is going on. 

Also please re-post your specs here just for clarity for everyone else.  I saw in the other thread you mentioned something about a MAC?  You wouldn't be running windows via emulation would you, because the reason we can't move individual mice via software is largely due to a bug in windows itself. 

vandale

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 318
  • Id 10 and t error
Re: Sega Model 2 Emulator Full Screen Shooter fix - RamjetM2Borderless - App
« Reply #56 on: January 14, 2013, 02:14:10 am »
It would, so I can undestand exactly what is going on. 

Also please re-post your specs here just for clarity for everyone else.  I saw in the other thread you mentioned something about a MAC?  You wouldn't be running windows via emulation would you, because the reason we can't move individual mice via software is largely due to a bug in windows itself.

Hi. No windows emulation, its just Windows 7 32bit ultimate on a 2009 MacBook Pro.

Specs as per other post:
Macbook pro bootcamp windows 7 Ultimate 32 bit
Standard microsoft Bluetooth stack (auto connects to wiimotes)
Glovepie free
MAME Wii Lightgun Glovepie Script by HowardC Version 1.5
PP joy (takes wiimote input and converts to windows gamepads)
M2 v1.0
Virtua Cop
M2 Ini set as:
[Input]
XInput=0         ;Enable support for Xbox360 compatible devices
EnableFF=0         ;Enable Force Feedback Effects
HoldGears=0         ;Set to 1 to return to Neutral in driving games when the gear shift key is released
UseRawInput=1         ;Read mouse through Rawinput, allowing 2 mice
RawDevP1=3         ;Assign specific RawInput devices to players. If you have more than 2 mice
RawDevP2=4         ;set which one is assigned to each player (0-based)

Video in a few mins
Thanks

vandale

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 318
  • Id 10 and t error
Re: Sega Model 2 Emulator Full Screen Shooter fix - RamjetM2Borderless - App
« Reply #57 on: January 14, 2013, 06:50:47 am »
very poor quality video

http://tinyurl.com/a9w7vag

look for the small circle cross hairs

Howard_Casto

  • Idiot Police
  • Trade Count: (+1)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 16758
  • Your Post's Soul is MINE!!! .......Again??
    • The Dragon King
Re: Sega Model 2 Emulator Full Screen Shooter fix - RamjetM2Borderless - App
« Reply #58 on: January 14, 2013, 07:44:18 am »
Ok second question.... how many mice are hooked up to your mame cab?   (If it's running off the laptop include the touch pad).  The reason I'm asking is that you've got the raw mice ids set to 3 and 4. 

BadMouth

  • Trade Count: (+6)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 8415
  • ...
Re: Sega Model 2 Emulator Full Screen Shooter fix - RamjetM2Borderless - App
« Reply #59 on: January 14, 2013, 09:24:31 am »
Didn't see the other cursor coming.
Mind blown.
:blowup:


Do the crosshairs on the positional gun games track?
(Gunblade NY, Rail Chase 2, Behind Enemy Lines)
I'm talking about the ones that were part of the original games, not the ones added by M2Emulator.


vandale

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 318
  • Id 10 and t error
Re: Sega Model 2 Emulator Full Screen Shooter fix - RamjetM2Borderless - App
« Reply #60 on: January 15, 2013, 04:52:19 am »
Ok second question.... how many mice are hooked up to your mame cab?   (If it's running off the laptop include the touch pad).  The reason I'm asking is that you've got the raw mice ids set to 3 and 4.

1 USB mouse connected. Touchpad/keyboard disabled in device manager as this is an insurance write off unit with liquid damage to keyboard and touchpad.

No matter what id's I set the ini file it still works on both wiimotes independantly

Thanks

vandale

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 318
  • Id 10 and t error
Re: Sega Model 2 Emulator Full Screen Shooter fix - RamjetM2Borderless - App
« Reply #61 on: January 15, 2013, 04:55:32 am »
Didn't see the other cursor coming.
Mind blown.
:blowup:


Do the crosshairs on the positional gun games track?
(Gunblade NY, Rail Chase 2, Behind Enemy Lines)
I'm talking about the ones that were part of the original games, not the ones added by M2Emulator.

No the original cross hairs do not track, only the small circles added by M2.

I was thinking, if I run a wiimote dual mouse script then there is no reason why this wont work and it may improve the tracking. Will see how I go.
Thanks
Gene

Howard_Casto

  • Idiot Police
  • Trade Count: (+1)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 16758
  • Your Post's Soul is MINE!!! .......Again??
    • The Dragon King
Re: Sega Model 2 Emulator Full Screen Shooter fix - RamjetM2Borderless - App
« Reply #62 on: January 15, 2013, 04:51:40 pm »
Unfortunately I think what you are seeing is a graphics error and nothing more. 

As I stated previously, my scripts aren't designed to work outside of mame.  They show these fake (and essentially useless) cursors in anything else.  Take the fact that you've turned off visual themes and directx/ogl doesn't like these fake cursors and what you are propbably seeing is a corrupted pointer "stripped" of it's icon.  I could be wrong on this of course, but from my own testing, I think that is what you are seeing. 

A dual mice script won't work in windows 7 (or anything really) due to changes in windows.  While we can detect movement in individual mice hardware, we can't fake it.  Don't let those pointers fool you, they aren't real.

I've done extensive testing on model 2, and outside of using two real mice, or injecting data into the memory locations, you can't run two wiimotes (or anything for that matter) at once.  I wanted to make sure I hadn't missed anything though, which is why I asked you all of those questions.  Feel free to experiment, but I doubt you'll find the answers you seek. 

vandale

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 318
  • Id 10 and t error
Re: Sega Model 2 Emulator Full Screen Shooter fix - RamjetM2Borderless - App
« Reply #63 on: January 15, 2013, 10:07:07 pm »
Unfortunately I think what you are seeing is a graphics error and nothing more. 

As I stated previously, my scripts aren't designed to work outside of mame.  They show these fake (and essentially useless) cursors in anything else.  Take the fact that you've turned off visual themes and directx/ogl doesn't like these fake cursors and what you are propbably seeing is a corrupted pointer "stripped" of it's icon.  I could be wrong on this of course, but from my own testing, I think that is what you are seeing. 

A dual mice script won't work in windows 7 (or anything really) due to changes in windows.  While we can detect movement in individual mice hardware, we can't fake it.  Don't let those pointers fool you, they aren't real.

I've done extensive testing on model 2, and outside of using two real mice, or injecting data into the memory locations, you can't run two wiimotes (or anything for that matter) at once.  I wanted to make sure I hadn't missed anything though, which is why I asked you all of those questions.  Feel free to experiment, but I doubt you'll find the answers you seek.

Hi, the small circles do work as cross hairs when I run my digital joysticks in m2, they shoot from different guns and work independantly so I am not sure why you are rejecting this as working when it clearly does work, even the individual scores go up for both P1 and P2.

The issue with the wiimote is they dont track with the cross hair properly but do if you over compensate, the question isnt whether they are connected and work indpeendantly in M2 as they do. Will post a link in a few mins of the 2 joysticks working.

Thanks

vandale

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 318
  • Id 10 and t error
Re: Sega Model 2 Emulator Full Screen Shooter fix - RamjetM2Borderless - App
« Reply #64 on: January 15, 2013, 10:39:49 pm »
vid
video 2013 01 14 21 02 53

BadMouth

  • Trade Count: (+6)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 8415
  • ...
Re: Sega Model 2 Emulator Full Screen Shooter fix - RamjetM2Borderless - App
« Reply #65 on: January 15, 2013, 10:47:29 pm »
RamJetR remembered having two wiimotes working long ago, but has been unable to recreate it.
He's done many great things, but I had my doubts that he was remembering correctly.  ;D

I don't doubt either of you now.  The question is where M2 is getting the input from.
Perhaps analog joystick input is supported in these games, but certain conditions (which we don't know) must be met.

Please continue posting vids and info about your setup and thanks for what you've posted so far.
 :cheers:

BadMouth

  • Trade Count: (+6)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 8415
  • ...
Re: Sega Model 2 Emulator Full Screen Shooter fix - RamjetM2Borderless - App
« Reply #66 on: January 15, 2013, 11:16:56 pm »
Holy crap just duplicated this in Virtua Cop! (kinda)

I am using a real dual analog gamepad, not wiimotes or ppjoy.
I had raw input set to 0 in the ini file.
Then launched the game and mapped the joystick directions (used the second analog stick for player 2).
Then changed raw input to 1 and launched it again.

The weird cursors didn't appear until I entered coins and pressed start.
At one point they disappeard.  It seemed to coincide with pressing one of the other buttons on the controller, but I'm not sure.
I never could get them back during that game, but the next time I launched the emulator, they were back.
They work independently and each player's fire button works and goes to the spot of the weird cursor.

Gave gunblade a quick try and couldn't get them to appear.

Unfortuneatly I need sleep and am already late to bed.
.....but it does work in Virtua Cop anyway.

EDIT: Virtua Cop 2 works as well, but the crosshairs are X's instead of O's
         The cursors only move during gameplay.  They stop responding when you die and jump to the upper left corner of the screen when you press start to continue (as if they are being reset).

EDIT2: Seems to only work on Virtua Cop and Virtua Cop 2  :-\
           I tried HOTD, Gunblade & Behind Enemy Lines.  Rail Chase is missing from my laptop for some unknown reason.

For Act Labs guns anyway, if there is a way to have the virtual joysticks snap to the point on the screen where the gun is fired before registering the shot, then we are in business.  It wouldn't need to inject the coordinates directly into the program like the troubleshooter does.  You'd have the odd cursors in the last place you shot, but it would be a small price to play for 2 player virtua cop IMO.

Accurate tracking with an IR gun would be a whole different can of worms.  :-\


I just wanna play Gunblade NY with my big positional gun!!!!!   :angry:

« Last Edit: January 15, 2013, 11:53:07 pm by BadMouth »

vandale

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 318
  • Id 10 and t error
Re: Sega Model 2 Emulator Full Screen Shooter fix - RamjetM2Borderless - App
« Reply #67 on: January 16, 2013, 06:40:35 am »
Holy crap just duplicated this in Virtua Cop! (kinda)

I am using a real dual analog gamepad, not wiimotes or ppjoy.
I had raw input set to 0 in the ini file.
Then launched the game and mapped the joystick directions (used the second analog stick for player 2).
Then changed raw input to 1 and launched it again.

The weird cursors didn't appear until I entered coins and pressed start.
At one point they disappeard.  It seemed to coincide with pressing one of the other buttons on the controller, but I'm not sure.
I never could get them back during that game, but the next time I launched the emulator, they were back.
They work independently and each player's fire button works and goes to the spot of the weird cursor.

Gave gunblade a quick try and couldn't get them to appear.

Unfortuneatly I need sleep and am already late to bed.
.....but it does work in Virtua Cop anyway.

EDIT: Virtua Cop 2 works as well, but the crosshairs are X's instead of O's
         The cursors only move during gameplay.  They stop responding when you die and jump to the upper left corner of the screen when you press start to continue (as if they are being reset).

EDIT2: Seems to only work on Virtua Cop and Virtua Cop 2  :-\
           I tried HOTD, Gunblade & Behind Enemy Lines.  Rail Chase is missing from my laptop for some unknown reason.

For Act Labs guns anyway, if there is a way to have the virtual joysticks snap to the point on the screen where the gun is fired before registering the shot, then we are in business.  It wouldn't need to inject the coordinates directly into the program like the troubleshooter does.  You'd have the odd cursors in the last place you shot, but it would be a small price to play for 2 player virtua cop IMO.

Accurate tracking with an IR gun would be a whole different can of worms.  :-\


I just wanna play Gunblade NY with my big positional gun!!!!!   :angry:

YESSSSSS!!! Finally someone believes me :0

I get the funny circle cross hairs in HOD aswell and can play 2 player independant. I havnt tried VC2 though.

This is identical to how it works with my wiimotes. If the wiimote could be fixed to the circle and keep tracking in realtime rather than the digital method thats hard to see in my forst vid then sweet I would be happy with that.

Thanks


retrorepair

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 242
Re: Sega Model 2 Emulator Full Screen Shooter fix - RamjetM2Borderless - App
« Reply #68 on: January 16, 2013, 06:50:19 am »
This is most likely some residual debug code for M2Emu and the lightgun games. The fact Gunblade doesn't show them gives a little weight to that. Does it happen in Railchase 2?

vandale

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 318
  • Id 10 and t error
Re: Sega Model 2 Emulator Full Screen Shooter fix - RamjetM2Borderless - App
« Reply #69 on: January 16, 2013, 06:59:26 am »
This is most likely some residual debug code for M2Emu and the lightgun games. The fact Gunblade doesn't show them gives a little weight to that. Does it happen in Railchase 2?

Or some early code before M2's developer went MIA

Howard_Casto

  • Idiot Police
  • Trade Count: (+1)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 16758
  • Your Post's Soul is MINE!!! .......Again??
    • The Dragon King
Re: Sega Model 2 Emulator Full Screen Shooter fix - RamjetM2Borderless - App
« Reply #70 on: January 16, 2013, 03:18:26 pm »
Yeah I'm not sure what everyone is getting so excited about.  Not working right is still the same as not working. 

Memory hacking is how this problem is going to be solved.  I'm already working on it, just not right now because I've still got video games to play from xmas. 

vandale

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 318
  • Id 10 and t error
Re: Sega Model 2 Emulator Full Screen Shooter fix - RamjetM2Borderless - App
« Reply #71 on: January 16, 2013, 11:04:32 pm »
Yeah I'm not sure what everyone is getting so excited about.  Not working right is still the same as not working. 

Memory hacking is how this problem is going to be solved.  I'm already working on it, just not right now because I've still got video games to play from xmas.

What a way to kill a thread

retrorepair

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 242
Re: Sega Model 2 Emulator Full Screen Shooter fix - RamjetM2Borderless - App
« Reply #72 on: January 17, 2013, 06:28:36 am »
This wasn't your thread to begin with and also, he's right.

You can go ahead and prove him wrong if you want but honestly, it's nothing that can be exploited.

BadMouth

  • Trade Count: (+6)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 8415
  • ...
Re: Sega Model 2 Emulator Full Screen Shooter fix - RamjetM2Borderless - App
« Reply #73 on: January 17, 2013, 09:34:55 am »
I think there is a way to parlay this new discovery into a solution for Act Labs guns anyway.

I'm no dev, but I've cobbled together AHK scripts to do some crazy things and I think this is possible.
I have a million other things to do, but I'll probably tinker with this.
It hasn't been done before and it's on the edge of my skill level.  That makes it hard to resist working on.
I'll start a new thread if I get anywhere with it, but here is the general idea:

1. create fake dual analog joystick in ppjoy and in M2emulator map one stick to p1 and the other to p2, map each trigger to a gamepad button
2. Get mouse position when trigger is pulled (mouse button)
3. Have AHK set analog joystick position, then press gamepad button to fire

Which analog stick moves and which fire button gets pressed would depend on which act labs trigger was pulled.


This script looks promising:

Code: [Select]
MouseGetPos, MouseX, MouseY

; Values must be within 0-100 range
YVal := 100-Round(100*(A_ScreenHeight-MouseY)/A_ScreenHeight)
XVal := 100-Round(100*(A_ScreenWidth-MouseX)/A_ScreenWidth)

PPJ_SetAxis(2, Yval) ;Axis 2 is the Y axis
PPJ_SetAxis(1, Xval) ;Axis 1 is the X axis
}

Sounds like it does the joystick position as a percentage of the screen dimensions...sounds promising to me.

source:
http://www.autohotkey.com/board/topic/48827-ppjoy-library/

On a side note, doesn't the Aim-Trak have a "joystick mode" ?
« Last Edit: January 17, 2013, 09:39:57 am by BadMouth »

Howard_Casto

  • Idiot Police
  • Trade Count: (+1)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 16758
  • Your Post's Soul is MINE!!! .......Again??
    • The Dragon King
Re: Sega Model 2 Emulator Full Screen Shooter fix - RamjetM2Borderless - App
« Reply #74 on: January 17, 2013, 11:11:05 am »
Won't work bad mouth.  That's the main issue with model2.  It doesn't support analog or digital joysticks for gun games.  AT ALL.  It supports mice, and dual mice at that, but no joysticks other than the triggers (because they are also mapped to p1 button 1 in model 2). 

We can't fake the mice because m2 is using rawmouse.  Raw Mouse functions, read the position via the individual hardware drivers.  There isn't a way to fake this in windows, period.  The only way we could would be to make a fake mouse driver, which is far more involved than just using a memory hack to do it.  Of course you can fake the mouse for a single player game if you turn off rawmouse, but that kind of defeats the purpose. 

Messed with Model 2 inputs/outputs for over a month before the holidays hit, rest assured I tried pretty much everything.  The only thing that responded properly was injecting the values straight into memory and the reason I didn't release anything is because finding the initial memory location is a bit tricky (but possible). 



BadMouth

  • Trade Count: (+6)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 8415
  • ...
Re: Sega Model 2 Emulator Full Screen Shooter fix - RamjetM2Borderless - App
« Reply #75 on: January 17, 2013, 11:27:40 am »
It doesn't support analog......joysticks for gun games.  AT ALL.

That's what I thought until I played Virtua Cop and Virtua Cop 2 using a logitech analog gamepad the day before yesterday.

The stick that was mapped to P1, moved the weird "0" P1 pointer. 
The stick that was mapped to P2, moved the weird "0" P2 pointer. (both are identical)

The button mapped to P1 Button1 fired bullets from P1's gun to the place where P1's pointer was.
The button mapped to P2 Button1 fired bullets from P2's gun to the place where P2's pointer was.

I did not figure out how to reload, but only messed with it a short time.

Moving the mouse had no effect on either the original or the weird debug crosshairs.

Mapping had to be done without RawInput enabled.
The sticks worked after launching the emulator again with RawInput enabled.
(although obivously it's enabling something other than raw input)

It did not work for me on the positinal gun games or HOTD.
vandale said it worked for him on HOTD.  I only tried it once.
I will give it another try tonight.

It may be leftover debug code or something, but it's there.


« Last Edit: January 17, 2013, 11:29:29 am by BadMouth »

Howard_Casto

  • Idiot Police
  • Trade Count: (+1)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 16758
  • Your Post's Soul is MINE!!! .......Again??
    • The Dragon King
Re: Sega Model 2 Emulator Full Screen Shooter fix - RamjetM2Borderless - App
« Reply #76 on: January 17, 2013, 12:19:36 pm »
*sigh*

But that's not "support" now is it?

As I said before, not working correctly is still the same as not working. 


Except for the debug cursors as you called them, I discovered all of this during my testing.  In the memory editor I could actually see the joystick positions, this isn't news to me that in some of the games it tracks the joysticks even though it doesn't do anything with them.  Again, the only solution that seems to work is memory hacking. 

vandale

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 318
  • Id 10 and t error
Re: Sega Model 2 Emulator Full Screen Shooter fix - RamjetM2Borderless - App
« Reply #77 on: January 17, 2013, 04:14:30 pm »
This wasn't your thread to begin with and also, he's right.

You can go ahead and prove him wrong if you want but honestly, it's nothing that can be exploited.

Thanks for your unnecessary comments.

By the way, I am not trying to prove anyone wrong, just like you I am a fan of old school games and replicating them as close to the original as possible, thought I could assistthis project as I didnt see anyone have 2 players working independantly like I had.


Howard_Casto

  • Idiot Police
  • Trade Count: (+1)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 16758
  • Your Post's Soul is MINE!!! .......Again??
    • The Dragon King
Re: Sega Model 2 Emulator Full Screen Shooter fix - RamjetM2Borderless - App
« Reply #78 on: January 18, 2013, 08:26:38 pm »
This wasn't your thread to begin with and also, he's right.

You can go ahead and prove him wrong if you want but honestly, it's nothing that can be exploited.

Thanks for your unnecessary comments.

By the way, I am not trying to prove anyone wrong, just like you I am a fan of old school games and replicating them as close to the original as possible, thought I could assistthis project as I didnt see anyone have 2 players working independantly like I had.

You know, ramjet, retrorepair and myself are the only ones who have made any progess with adding functionality to M2, so you should really watch who you agitate.  Your initial comment about me killing the thread was the unnecessary one, so you are the pot calling the kettle black.   

If you had followed the thread then you would know that both ramjet and myself are working on this. I know it sucks to be patient, but sometimes you have to. 

 It isn't a matter of proving right and wrong, it's just you were saying "hey this works" when in fact it doesn't.  I mean you were asking about how the script is moving those cursors and I replied by simply saying "it isn't" and you kept insisting that it was.  I coded the scripts, I know what they can and cannot do.  And yes, you seem to have found an artifact of code inside M2, but as I explained to badmouth, that doesn't really help us because the joystick positions M2 is tracking aren't hooked up to the inputs in the games, and even if they were, they aren't present in all of the games.

I mean if you guys want to play around and see if you get lucky be my guest, but all of the methods you guys have suggested thus far I've already tried.  I just hate to see somebody pull their hair out trying to get something to work that most likely isn't.   

Howard_Casto

  • Idiot Police
  • Trade Count: (+1)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 16758
  • Your Post's Soul is MINE!!! .......Again??
    • The Dragon King
Re: Sega Model 2 Emulator Full Screen Shooter fix - RamjetM2Borderless - App
« Reply #79 on: January 20, 2013, 12:48:31 pm »
Ok getting back on a positive note.


I've been working on my "troubleshooter 2" app because it will use dde communication with mamehooker for outputs (optionally of course) and I want to make sure I don't have to add anything to the dde module before I release mamehooker. 

I've dual guns and joystick guns "sort of" working.  It's glitchy, but at least it's playable.  For P1's gun as a joystick it's really easy, I just fake the system mouse.  It works great 100% of the time.

For P2, I inject the proper byte value into the system memory. 

It works, but because I haven't found the memory address that is called at the beginning of the render loop, model 2 fights me and constantly sets it back to the original position.  The end result is a cursor that flickers a little because it keeps momentarily moving back to the top corner of the screen. 

Now my troubleshooter app doesn't have any hardcoded values... we can go back once this magical address is discovered, change the ini, and it will work properly.  I think with our previous experimentation we found that it's in a random place each time, and yet it's relative to model 2's address in memory.  That's a bit tricker to work out, but it's still doable. 

BadMouth

  • Trade Count: (+6)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 8415
  • ...
Re: Sega Model 2 Emulator Full Screen Shooter fix - RamjetM2Borderless - App
« Reply #80 on: January 20, 2013, 02:30:45 pm »
For P2, I inject the proper byte value into the system memory. 

It works, but because I haven't found the memory address that is called at the beginning of the render loop, model 2 fights me and constantly sets it back to the original position.  The end result is a cursor that flickers a little because it keeps momentarily moving back to the top corner of the screen. 

Would someone using Act labs guns without the crosshairs turned on notice anything?
In other words do all shots still go where P2's gun is pointed?


I know you aren't interested, but for anyone who might be:
Raw input doesn't have to be enabled to get the weird joystick controlled crosshairs on the screen in vcop.
They are activated by pressing P2, button 2.
It also changes the game to unlimited ammo and P1 has rapid fire if the trigger is held.
It accepts input from virtual joysticks (vjoy) as well as real ones.
I still couldn't get them to show up in HOTD.

If you're this close to having the game work as it should, I guess I won't mess with it much more.  :)
« Last Edit: January 20, 2013, 03:19:59 pm by BadMouth »

Howard_Casto

  • Idiot Police
  • Trade Count: (+1)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 16758
  • Your Post's Soul is MINE!!! .......Again??
    • The Dragon King
Re: Sega Model 2 Emulator Full Screen Shooter fix - RamjetM2Borderless - App
« Reply #81 on: January 20, 2013, 06:48:02 pm »
Well I'm talking about the game crosshair, not model 2's  What happens is maybe 1 shot out of 25 happens in the upper corner instead of where it should.   Maybe more on the VCop games, although it's less of an issue for them as I can set the position as the trigger is fired making it hit 100% of the time.  It's the analog games that are tricky. 

Actually if I could find where model 2's crosshair code is, I think I could fix it.  This is something we can all work on really. 
I thought I had found it as the postion was in pixels instead of a hex value, but altering it didn't help.  It's just one of those things where you have to play around in the memory with Art Money for ages, which unfortunately I haven't had time to do. 


Yeah I found all kinds of wieredness with the leftover analog code.  It's been causing issue to where I'll have to use a memory hack for the triggers in some games because mapping it in m2 causes the issues you were talking about. 

Howard_Casto

  • Idiot Police
  • Trade Count: (+1)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 16758
  • Your Post's Soul is MINE!!! .......Again??
    • The Dragon King
Re: Sega Model 2 Emulator Full Screen Shooter fix - RamjetM2Borderless - App
« Reply #82 on: January 20, 2013, 10:37:07 pm »
If you've been following the mamehooker wip I just fixed it's dde communication. 

I wanted to test my troubleshooter app to see if it could send data to mamehooker reliably.  I set the timeout to something ridiculous like 1 millisecond, to keep things form bogging down and to my suprise mamehooker never lost a single transmisson!  I tried it with gunblade, which has those rapid gun recoils, so I figure everything else is fair game as well. 

Anyway, things are shaping up! 

retrorepair

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 242
Re: Sega Model 2 Emulator Full Screen Shooter fix - RamjetM2Borderless - App
« Reply #83 on: January 21, 2013, 11:27:18 am »
Quote
For P2, I inject the proper byte value into the system memory. 

It works, but because I haven't found the memory address that is called at the beginning of the render loop, model 2 fights me and constantly sets it back to the original position.  The end result is a cursor that flickers a little because it keeps momentarily moving back to the top corner of the screen. 

Now my troubleshooter app doesn't have any hardcoded values... we can go back once this magical address is discovered, change the ini, and it will work properly.  I think with our previous experimentation we found that it's in a random place each time, and yet it's relative to model 2's address in memory.  That's a bit tricker to work out, but it's still doable.

This is about as far as I got before I gave up. Artmoney or Cheat Code Engine couldn't seem to locate the address writing to the analog data (I tested with Gunblade) so as you say any code injected was just immediately overwritten. Your troubleshooter app seems to have had better luck than Lua though. I never tried with the lightgun games.

I'll take another look and see if I come up with anything but last time I only seemed to find what you already have.

In regards to lamp outputs, I've attached what I have found so far. I didn't try everything, mostly just the racing games. I also included my autohotkey script which interfaces to the pacdrive. Not much use but for completeness etc. I was going to tidy it up and release it but as things are now underway with mamehooker.. ;)

FYI all the racing games use the same values for lamps, 4 for start lamp, 128 for leader lamp etc. The guns games and probably others use different values for some (think start lamp in vcop for example is 12?).
« Last Edit: January 21, 2013, 11:31:10 am by retrorepair »

Howard_Casto

  • Idiot Police
  • Trade Count: (+1)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 16758
  • Your Post's Soul is MINE!!! .......Again??
    • The Dragon King
Re: Sega Model 2 Emulator Full Screen Shooter fix - RamjetM2Borderless - App
« Reply #84 on: January 21, 2013, 12:09:07 pm »
Yeah that's pretty standard sega stuff.  They cram all the output data into a single byte (or sometimes two if it's a crazy game) so that it can quickly be sent to the output hardware board.  Sega's been doing interactive hardware since the dawn of the arcades and they really understand how to do it right.  Compare that to 90's Midway games, where the output byte is a pulsing, strobing mess and you really start to appreciate it.  ;)

The individual outputs are detected via bitmasking.  Comparing a bitmask of 4 to the total number is almost always start 1, 8 is start 2, ect.....


I've got most of them already. 


Desert Gun is particularly interesting.  It's got one feedback motor for the machine gun and a stronger motor for the cannon.  Since the typical xbox 360 controller has a strong motor on one side and a weak one on the other, it should make for some very authentic feedback. 

RamjetR

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 144
    • My Youtube Channel
Re: Sega Model 2 Emulator Full Screen Shooter fix - RamjetM2Borderless - App
« Reply #85 on: January 21, 2013, 06:19:13 pm »
I didn't get a chance to mention over the christmas period, but I managed to get cheat engine to nop the instructions overwriting the x/y coordinates in the emulator. With that stopped, there shouldn't be any reason external x/y injection should not now work.

*****Edit****
Wow, much has happened in the last page or so.... ummm ok, where to Start [Insert Coin] Everyone cries! Bad pun's indeed

There are many ways to skin a cat in the quest to include working 2p Shooters for M2.

Vandale, thanks for proving to everyone that joysticks do infact work. Even if the data is sourced from the Wiimotes through PPJoy. Oddly enough, when I managed to do it, the normal crosshairs moved correctly? I didn't have a circle reticle, but that said I wasn't using any specific script but a basic dual wiimote to joystick script. Honestly, I thought I must have dreamed it at one point but I even grabbed the girlfriend and showed her and we played a couple of games (with the wiimote upside down because I hadn't remapped the buttons).

Memory injection is probably going to be the cleanest method in the long run. Given that people's machines will have multiple inputs and it's quite specific and even luck to get the ID's of the raw input devices correct when changing hardware around regularly for multi emulation machine setups. The OS is just gonna fight you with the hardware ID changing when devices are plugged in and removed. Howard is working mega hard on memory injection and if the modifications to Troubleshooter works out well, then it'll be a simple 1 application for many programs result. It'll just be nice and clean. As mentioned above Howard, I have some code being executed by the emulator itself (not the emulated ROM) which access's the X/Y Writes to the emulated game NOP'ed and it stops the crosshairs fine... so I can pass that on for you and we can make a trainer for the emulator to auto run as a hack to lock out it's control of the aiming.

On a side note, since I've been playing with Arduino's a bit lately, I'd even made a prototype sketch to pull joystick X/Y's from the system, send it over Com10 to the arduino and report it back through the same USB connector as a HID mouse with relative input data. It does work, but not an ideal fix since you'd need to buy and program your own arduino usb key, an P2 dongle so to speak lol. Interesting little gadget and especially cool if your into making your own HID input devices. It's a completely different kinda approach but been a fun learning exercise with arduino's over the last fortnight.

Great to see progress even if I'm not 100% available to help more... seriously... I need more time to do everything that needs to be done in a day. Spend 20 of the last 48 hours painting the brother in law's house... 
« Last Edit: January 21, 2013, 07:18:40 pm by RamjetR »
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

Howard_Casto

  • Idiot Police
  • Trade Count: (+1)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 16758
  • Your Post's Soul is MINE!!! .......Again??
    • The Dragon King
Re: Sega Model 2 Emulator Full Screen Shooter fix - RamjetM2Borderless - App
« Reply #86 on: January 21, 2013, 08:36:46 pm »
Yeah man if you could go into detail as to what you've found out that would be extremely helpful. 

Right now I'm just trying to get the troubleshooter finished.  It works just fine, but I've simply been using hardcoded values for testing.  I have to actually make the thing configurable and user-friendly now, which takes FOREVER.  ;)

Mine is going to work differently from the original though.  It was setup as a system process, which, while automatic, is a bit intrusive if you ask me.  I'm setting this one up to simply be launched with a command line string sort of like a rom name.  You'll make an ini for each "rom" that contains all the useful info and a path and exe (the pc game) that can optionally be launched for you.  Obviously this isn't necessary for model 2, we can have the lua script launch the troubleshooter, but for pc lightgun games like house of the dead III this just seems like a cleaner method. 

That also gives us the added benefit of being able to add support for other stuff later on.  The troubleshooter 2 will have optional support to inject positional values as well as reading memory locations and translating them to outputs for mamehooker.  So you could also use it to send outputs to mh for a pc game, or add mamehooker suport for an oddball emulator like daphne.   

**Update**

I finished the joystick configuration, so that's done.

I also finished the output reading function. 

So what's left is to remove the hard codings on the memory injection fucntions and and raw mouse functions.  Then I need to do minor junk like allow for key redirecting, check for title bar captions/classes and allow for exit keys. 
« Last Edit: January 21, 2013, 11:24:02 pm by Howard_Casto »

Howard_Casto

  • Idiot Police
  • Trade Count: (+1)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 16758
  • Your Post's Soul is MINE!!! .......Again??
    • The Dragon King
Re: Sega Model 2 Emulator Full Screen Shooter fix - RamjetM2Borderless - App
« Reply #87 on: January 22, 2013, 12:00:20 am »
Sometimes a picture is worth a thousand words:

http://img43.imageshack.us/img43/4200/outputsk.jpg

On the far left is model2 displaying Gunblade's output test menu.  The gray box in the middle is the troubleshooter app (yes I know it's a mess).  Note that it has read the output regions from M2 and is displaying them in the bottom right corner.  And on the far right is good old mamehooker running as if a mame game was active.  Note that all across the board, the outputs are in sync. 

Mamehooker is pitching a fit when the first set of outputs are sent so I've gotta figure out what's going on there, but other than that it's working perfectly.  So yeah this is a good test of mh's dde functions before I release it. 

retrorepair

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 242
Re: Sega Model 2 Emulator Full Screen Shooter fix - RamjetM2Borderless - App
« Reply #88 on: January 22, 2013, 12:11:53 am »
Great work as ever Howard, looking very cool!

Mamehooker is pitching a fit when the first set of outputs are sent

I've actually noticed this with mamehooker and mame. The outputs don't work at all for about 20-30 seconds after mame's loaded but then everything freezes and it all works after that. Only from first boot of the computer though. After that it's fine between other games.

Howard_Casto

  • Idiot Police
  • Trade Count: (+1)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 16758
  • Your Post's Soul is MINE!!! .......Again??
    • The Dragon King
Re: Sega Model 2 Emulator Full Screen Shooter fix - RamjetM2Borderless - App
« Reply #89 on: January 22, 2013, 12:43:37 am »
Great work as ever Howard, looking very cool!

Mamehooker is pitching a fit when the first set of outputs are sent

I've actually noticed this with mamehooker and mame. The outputs don't work at all for about 20-30 seconds after mame's loaded but then everything freezes and it all works after that. Only from first boot of the computer though. After that it's fine between other games.

Yeah that's a different issue all-together that I've run across.  Mame uses window messages to send me data right?  Well the proces that handles this seems sluggish to boot up or something.  I'm not sure what it is, but afaik it's not on my end. 

Anyway I found the issue.  If you've been following the mamehooker thread you know that I've added support for multiple emulators.  The bug was related to that.  Each emulator gets it's own folder in the ini folder now.  When writing a new ini file for the newly discovered outputs, I forgot to check if the folder actually exists first.  OOPS!

That's one of the nasty things about DDE communcation btw.  As a client it's really stable (and all things talking to mamehooker use it in client mode) but as a server, your program will crash and close whenever an error is raised before the dialog box pops up.  So whenever I'm troubleshooting mamehooker with DDE active, I can't check for debugging.   :banghead:


I've got a question for you guys in regards to lightguns, maybe some of you can chime in. 

I'm looking at the rawmouse code and it's relative (UGH) instead of absolute, but I'm thinking that I don't need to read the positional data from rawmouse anyway.  The act labs (and similar) guns shared the system cursor correct?  And mame simply set p1 or p2's cursor position to the system mouse position whenever p1 or p2s trigger was pulled correct?

I guess what I'm asking is are there any dual lightguns out there that show up as mice and constantly update their position?  Like maybe an IR gun?

Howard_Casto

  • Idiot Police
  • Trade Count: (+1)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 16758
  • Your Post's Soul is MINE!!! .......Again??
    • The Dragon King
Re: Sega Model 2 Emulator Full Screen Shooter fix - RamjetM2Borderless - App
« Reply #90 on: January 22, 2013, 03:04:37 am »
You guys better be glad I can't sleep tonight. 

I was just poking around in the memory space and found the force-feedback byte for Sega Rally Championship!

The method they are using is almost identical to outrun.  You've got a force value, 1-8, and then a directional value, telling how far the car is turned.  I haven't figured out the masking yet, but it looks fairly simple to me.  Of course I found the lamps as well.  RetroRepair's lua script helped me find those. 

I would sure like to get the outputs for all the other games as well.  I looked at some of the scripts you guys had uploaded and it looks like those values found are the changing ones.  I've been trying very hard to find the static values as they are just easier to work with. 

Known outputs thus far:

VCop
VCop2
Gunblade NY
Rail Chase 2
HOTD
Sega Rally Championship. 

BadMouth

  • Trade Count: (+6)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 8415
  • ...
Re: Sega Model 2 Emulator Full Screen Shooter fix - RamjetM2Borderless - App
« Reply #91 on: January 22, 2013, 10:56:01 am »
You guys better be glad I can't sleep tonight. 

When I wake up in the morning and I see that you've posted in one of these threads "Today",  I know you were up late getting something done.  :lol

I'm looking at the rawmouse code and it's relative (UGH) instead of absolute, but I'm thinking that I don't need to read the positional data from rawmouse anyway.  The act labs (and similar) guns shared the system cursor correct? .......
I guess what I'm asking is are there any dual lightguns out there that show up as mice and constantly update their position?  Like maybe an IR gun? 

I have two act labs guns on my old setup.  They show up as individual HID mice in device manager. 
Knowing whether they share the system cursor is a bit over my head, but if there is a test I can do to figure that out, I will.

I seem to remember the first generation of act labs guns required a switch to be flipped on P2's gun and then the trigger and button would register as mouse button 3 and 4 (P1's registering as mouse buttons 1 & 2).  That sounds like they were sharing the mouse in windows, but mine don't work that way.
They work the same way two mice work when hooked up.  Either can control the pointer on the desktop.

With mice or aim-traks (IR gun), the MAME generated crosshairs track constantly, not just when the trigger is pulled.
I only have one aim-trak, so I'm not sure what happens on the desktop when both guns are pointed at the screen trying to controll the cursor.
Perhaps someone with two Aim-Traks can weigh in?

EDIT:

From MAME 0.104u5 what's new:
Quote
Derrick Renaud updated Windows input code: Now using RAWMOUSE mode if available. This means you can now use multiple mice in Windows XP. Lightgun support has not been changed yet.
  Added back DX7 support for the windows input system to support multiple mice. It was set to DX5 in 104u2.
  Removed the system mouse from the list of available mice on non-XP systems. This allows you to now properly select the individual mouse.
« Last Edit: January 22, 2013, 11:33:50 am by BadMouth »

DarthMarino

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 487
Re: Sega Model 2 Emulator Full Screen Shooter fix - RamjetM2Borderless - App
« Reply #92 on: January 22, 2013, 11:07:09 am »
^If you point both Aimtraks at the desktop, you see both cursors but they appear to flash very quickly. Both function fine though.

Howard_Casto

  • Idiot Police
  • Trade Count: (+1)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 16758
  • Your Post's Soul is MINE!!! .......Again??
    • The Dragon King
Re: Sega Model 2 Emulator Full Screen Shooter fix - RamjetM2Borderless - App
« Reply #93 on: January 22, 2013, 12:06:16 pm »
So the aim tracks show up as mice then.  Ugh that's what I was afraid of.  That means I'm going to have to store two virtual pos positions (in pixels) in the troubleshooter and move them as the guns are moved.  This in of itself isn't a big deal, but if I want to emulate the system mouse for p1, I have to know the cursor's initial position.  I guess I could set it to the center of the screen before I do any of my calculations. 

Anyway, on the Sega Rally dept, I figured out the bitmasking or lack thereof.  It's exactly like outrun's data format only slighly larger. 

I thought I might share so that you guys can understand why it's sometimes so hard to find the values in a memory editor. 

There's a single btye 4 bytes over from the lamp bytes.  It contains all FF data.  Inside the byte you've got 1-26 degrees of force giving a value of 1-26 in the byte.  That's simple enough but the direction is as follows:

Any value between 128 and 154 means the wheel is turning left.  So to get the left force you subtract 128 IF and only if the total value is between 128 and 154.  This gives you a leftward direction and a force value of 1 to 26.  Any value between 192 and 218 means the wheel is turning right.  So again, IF and only if the total byte value is in that range, you subtract 192 from it to get the power level.  Ok that's not too bad right?  Well wrong..... when the wheel is idle, it toggles between 128 and 192, the two lowest values.  I think this is a simulation to make the wheel hard to turn at a standing start, but in practice this will make things drift on a pc FF wheel.  So I have to ignore these values and set the direction to 0 (not turning) when either of those values are present.  To top all of that off, the driver board test menu in the service menu doesn't work as you would think.  You think that pressing the gas button ups the total force so you can see it in a memory editor as you are increasing the stars in the menu right?  Wrong.  That's the force multiplier, which multiplies by the current wheel direction to get force. And you guessed it, if you aren't turning the wheel as you are increasing the stars, the value doesn't change in memory. 

I just wanted to point all of that out because this may be why we can't find the true values in daytona... they are simply unrecgonizable. 

Trnzaddict

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 93
Re: Sega Model 2 Emulator Full Screen Shooter fix - RamjetM2Borderless - App
« Reply #94 on: January 22, 2013, 08:39:12 pm »
Howard, so are you working on a troubleshooter app to add 2 mice to Model 2 gun games? I've been following this thread for a couple of weeks now but it seems the focus was for glovepie but for actual mice like the Aimtraks, you would be making alot of people around the net very happy campers if this was possible.

RamjetR

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 144
    • My Youtube Channel
Re: Sega Model 2 Emulator Full Screen Shooter fix - RamjetM2Borderless - App
« Reply #95 on: January 22, 2013, 10:36:40 pm »
Howard,

There is a whole heap of FF data not just from the wheel but the entire car axis, yaw, acceleration forces available in the struct around the rpm and speed information I extract for the Symprojects dashboard in my cabinet. That's how I get the data out for xsim to display my Speedometer in Daytona and Sega Rally. I haven't explained any of this information that my current VR program gathers because it at the time was all surplus to anyone who wanted purely to emulate the original ROM on original hardware? If you want more information on the directional forces within the games, I can grab the artmoney files which show quite indepth FF data... I haven't built a motion platform yet... (yet) but the larger plan is to export this to X-Sim to drive a small motion platform at home.

Anywho.... back to VCOP... ok so I did this poking around with the actual emulator.exe and it appears that P1 X/Y coordinates are injected into the game from the code blocks in the CheatEngine file I've attached. Now, if you run the emulator, attach cheat engine with this profile you'll see in advanced options (click bottom status bar) that there is two lines of code I highlighted. You can show this in the disassembler to show the bytes of data which corrospond to the screen location of the mouse. The instructions at ;

emulator.exe+B5824
mov [00559CB0],edx (Y axis)

and

emulator.exe+B5835
mov [00559CAC],ecx (X Axis)

Directly influence the location of the bullet hit without effecting the crosshair. Now just after this in assembly there is another copy/paste of the same variables being mov'ed into the locations which effect the crosshair locations.

Within this area; I didn't map all of it since it's all located in a close structure... is Player 2 information. Exactly the same result.

To test it out, bring up the advanced options and right click on each of the bottom two code lines and "replace with code that does nothing" i.e. NOP... This will stall the updates of the mouse location and returns to the original code after skipping.

The cool bit is that it functions in all of the M2 shooters I've tried it with.

Here I've been researching into code injection where by we can allocate a small amount of ram for code to be injected and possibly hand over through LUA script which is more open for joystick or other device handling some updated X/Y coordinates.

Two approaches here perhaps then, you can halt the X/Y updates that the emulator forces on the game and externally inject your own. Or, use the same script which stops the mouse handling and inject it internally to the process.

It's been quite a journey to find this inside the running emulator.exe and this should clear you to do it however you want without fighting the emulator itself.

Ramjet
« Last Edit: January 22, 2013, 10:38:32 pm by RamjetR »
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

RamjetR

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 144
    • My Youtube Channel
Re: Sega Model 2 Emulator Full Screen Shooter fix - RamjetM2Borderless - App
« Reply #96 on: January 22, 2013, 10:45:48 pm »
Also... here is a program called Dienum

From memory I think I got it from a Logitech support page years ago? But it lists all of your attached input devices by number which correspond to the device ID you need to put into the emulator.ini for the raw input. Should take out some of the guess work out of setting your end up...

Ramjet
« Last Edit: January 22, 2013, 11:16:31 pm by RamjetR »
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

Howard_Casto

  • Idiot Police
  • Trade Count: (+1)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 16758
  • Your Post's Soul is MINE!!! .......Again??
    • The Dragon King
Re: Sega Model 2 Emulator Full Screen Shooter fix - RamjetM2Borderless - App
« Reply #97 on: January 23, 2013, 12:02:44 am »
All very helpful man, thanks. 

Here is the stumbling block I'm currently on. 

You know where all of these memory engines use the format   emulator.exe+address  ?  I can't figure out where to find the exe's location in memory anymore.  The trick I used to use apparently doesn't work as of Vista and beyond.  Obviously there is SOME way to do it because apps like ArtMoney and the Cheat Engine do it.  I just don't know how. 

If we can find that, then I can make the program much cleaner.  Since M2 doesn't protect anything I can simply re-write the pointer you mentioned to our own memory space and set things up there.  No need for lua or anything. 

Now of course there are lazier ways to do it..  I think the getrampointer function in lua could let use print out a text file with all the needed addresses but I'd hate to resort to that.  Any hacking experts please chime in, because my expertise is wrapping, not direct memory manipulation. 

RamjetR

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 144
    • My Youtube Channel
Re: Sega Model 2 Emulator Full Screen Shooter fix - RamjetM2Borderless - App
« Reply #98 on: January 23, 2013, 12:10:01 am »
How are you addressing the exe? I'm not sure on the Syntax, but I thought to address an executable you enclosed the exe with [emulator.exe]+0x"offset"

The system should resolve the base address of the executable for you shouldn't it?

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

Howard_Casto

  • Idiot Police
  • Trade Count: (+1)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 16758
  • Your Post's Soul is MINE!!! .......Again??
    • The Dragon King
Re: Sega Model 2 Emulator Full Screen Shooter fix - RamjetM2Borderless - App
« Reply #99 on: January 23, 2013, 12:40:24 am »
Eh not exactly. 

In vb (or c for that matter) I first find the window of the exe I wish to mess with (really simple to do). 

Then I use a "getprocessid" api call and get the process id. 

THEN I create a new process using the same PID, which allows me read/write access to the memory of the emulator. I use generic "readprocessmemory" and "writeprocessmemory" api calls... it's the safest way to manipulate memory in windows.   Now for static addresses like the outputs on gunbalde this works fine, but at no point (afaik) am I given the address of the actual exe, so I don't have that starting point for these dynamic addresses you gave me.  And since it's a exe+ entry in the cheat engine, that means it's different each time. 


I think there is a way to do it via some sort of clever counting when you enumerate processes.  I just don't have a good clear example of it. 

RamjetR

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 144
    • My Youtube Channel
Re: Sega Model 2 Emulator Full Screen Shooter fix - RamjetM2Borderless - App
« Reply #100 on: January 23, 2013, 01:02:46 am »
ooOOoooooh lol, sorry I misunderstood... the dynamic address I gave you there actually has a line number... the base address of the exe is 0x40000 (which appears to be quite a common entry point). But as you know that address is captive to the exe session and not the absolute address... but like doing a static read with the other offsets as it's mapped the same way.

If I'm understanding what your asking correctly (and never assume that I do lol) then where the line reads emulator.exe+B5824 the actual program address is 0x40000+B5824 = 004b5824

Since your opening a process with the same PID, then this is the address you have should have to read and write... Now this is how I've come to understand it. From many months of noob forum posts and expert replies... I may be right, I may likely be wrong.
« Last Edit: January 23, 2013, 01:15:18 am by RamjetR »
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

Howard_Casto

  • Idiot Police
  • Trade Count: (+1)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 16758
  • Your Post's Soul is MINE!!! .......Again??
    • The Dragon King
Re: Sega Model 2 Emulator Full Screen Shooter fix - RamjetM2Borderless - App
« Reply #101 on: January 23, 2013, 01:39:03 am »
Again, I'm no memory expert, but I think the best way to put that 0x40000 address is it's the section in memory where the exe is stored, not the specific address.  I tried plugging that in just to make sure I wasn't mistaken, but it doesn't work. 

This is evident by the fact that I can run m2 and have it print the actual address of a dynamic value via the GetRamPtr function and they will be different each launch.  These are the values I acutally need because I can plug them in and they work, but only during that specific launch. 


I've been going in circles tonight trying to figure out how to get the value I need... it might not be possible.  I'll work on the program more later this week, only I'll concentrate on the parts I DO know how to impliment for the time being. 

vandale

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 318
  • Id 10 and t error
Re: Sega Model 2 Emulator Full Screen Shooter fix - RamjetM2Borderless - App
« Reply #102 on: January 23, 2013, 05:51:13 am »
Hi guys.

I have been using a glovepie script called MouseParty which allows 4 mice on windows 7. If I edit the script down to 2 mice assigned to device 0 and 6 (usb mouse and macbook touchpad) then assign those devices in the M2 ini, I then get control over both red and blue cross hairs and can play 2 player independantly with trigger, reload and scores working correctly on each player.

Would the simple solution be a mashup of this MouseParty script and Howards Wiimote script thus allowing 2 wiimotes to act like mice on any chosed device ID which then configured in m2's ini to suit the specific device ID's you chose?

I have no glovepie script writing skills so cannot test my theory.

Come to think of it, if act labs guns act like mice then there is no reason why just using the MouseParty script wont work for those guns.

I can post a vid if need be?
Thanks

BadMouth

  • Trade Count: (+6)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 8415
  • ...
Re: Sega Model 2 Emulator Full Screen Shooter fix - RamjetM2Borderless - App
« Reply #103 on: January 23, 2013, 07:15:04 am »
Hi guys.

I have been using a glovepie script called MouseParty which allows 4 mice on windows 7. If I edit the script down to 2 mice assigned to device 0 and 6 (usb mouse and macbook touchpad) then assign those devices in the M2 ini, I then get control over both red and blue cross hairs and can play 2 player independantly with trigger, reload and scores working correctly on each player.

Two real mice (or touchpads) have always worked.  The rawinput M2 uses from real mice is "relative" meaning it only knows which direction and how far the mouse moves, but doesn't know where it started or where it is in space.  The mouse is incapable of reporting exactly where it is, only direction and distance.  You can pick it up and set it down in a different place on the desk and it makes no difference.

For guns, we need to know the "absolute" position where the gun is pointed.  Just knowing how far and what direction it moved doesn't work because M2 doesn't know where it started.  Even if you started the game with the gun pointed directly center every time, when you go offscreen, it would get screwed up.  It doesn't matter with mice or touchpads because you're not aligning them with anything on the screen.

Howard is attempting to do something similar to the original Troubleshooter program (whose author has been MIA for many years).
Here is a page that explains the issue and how the solution works:
http://thetroubleshooter.home.mindspring.com/howitworks.htm


There was a company that showed a "coffee table" pc recently with a huge touchscreen that multiple people could use at once.
I think it ran a custom version of windows 8.  So there's hope that future versions of windows will do away with only having one system mouse.
« Last Edit: January 23, 2013, 09:07:09 am by BadMouth »

BadMouth

  • Trade Count: (+6)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 8415
  • ...
Re: Sega Model 2 Emulator Full Screen Shooter fix - RamjetM2Borderless - App
« Reply #104 on: January 23, 2013, 09:13:41 am »
Just to make sure that I wasn't blowing a valid option out of the water, I checked out mouseparty.
http://www.mouse-party.com

Quote
Be sure you can control the windows mouse cursor with all mice connected. Test this on your desktop before playing a Mouse Party game. If all mice connected can control the cursor, and you have Windows XP, you should be ready to go. If there is a mouse that cannot control the cursor, that mouse will not be able to join the party.

Since all mice are controlling the same cursor, they are still all reporting as the same (just one) system mouse.
The game software is probably just rapidly switching between IDs.
Same old problem.

Howard_Casto

  • Idiot Police
  • Trade Count: (+1)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 16758
  • Your Post's Soul is MINE!!! .......Again??
    • The Dragon King
Re: Sega Model 2 Emulator Full Screen Shooter fix - RamjetM2Borderless - App
« Reply #105 on: January 23, 2013, 12:53:22 pm »
Yeah I know people are trying to be helpful and I really really appreciate it but I think there is a misconception as to what you can and cannot do in windows in regards to mice. 

Now for READING mice we can use raw mouse or direct input to read multiple mice at once... in relative mode only unfortuantely.  We can also get the exact position of the system mouse. 

As for WRITING, we can't write to any mouse other than the system mouse.  Microsfot considers moving the mouse at the hardware level a secuirty risk and thus makes it impossible.    People think that because they see two cursors on the screen that windows is reading two mice...... it isn't.  A custom program is manually drawing icons based upon the movement of the two mice. 

So any solution to where we make some other hardware device show up as two mice simply isn't going to work unless it's a hardware driver, because windows won't let you fake any mice other than the system mouse. 

Some things I'm admittedly not very good at (ahem memory hacking) but other things I would consider myself an expert at.  Faking inputs and keypresses would be one of those things.  I started in this hobby making wrappers to automate the launching of problem emulators via faking inputs and that was (dear god) over 16 years ago. 


That being said, I think I can work with relative mode in raw mouse in regards to fixing issues with existing lightgun "mice".  Mame does a fairly decent job of it.  It simply involves some tricky math so I was seeking another way.  As for devices that show up as joysticks... well they are always going to be joysticks, so we have to deal with them differently. 

Howard_Casto

  • Idiot Police
  • Trade Count: (+1)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 16758
  • Your Post's Soul is MINE!!! .......Again??
    • The Dragon King
Re: Sega Model 2 Emulator Full Screen Shooter fix - RamjetM2Borderless - App
« Reply #106 on: January 23, 2013, 01:57:55 pm »
I'm trying to figure out a rawmouse solution and as I don't have any true lightguns anymore I could use some help. 

I've attached my extremely crude raw mouse tester.  When you click the button your system mouse will be hidden and the first two mice on your system will be represented by the red and blue squares.  Now for true mice it's easy enough, but I don't know how it's going to react to an absolute mouse.  (Aka a lightgun or touchscreen).

Could you guys check that for me?  The position when you fire your lightgun might not be exact, because I haven't compensated for resolution and what have you, but it should be consistant. 

Please try it and let me know the results. 


Oh and press Escape to exit it btw.  ;)

BadMouth

  • Trade Count: (+6)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 8415
  • ...
Re: Sega Model 2 Emulator Full Screen Shooter fix - RamjetM2Borderless - App
« Reply #107 on: January 23, 2013, 02:16:22 pm »
Won't have time tonight, but I will dedicate tomorrow night to testing this with the Act Labs guns.

I have a single AIM-Trak and a few touchscreens I'll fiddle with if anything can be learned from it.

Endprodukt

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 619
  • I want to build my own arcade controls!
Re: Sega Model 2 Emulator Full Screen Shooter fix - RamjetM2Borderless - App
« Reply #108 on: January 23, 2013, 04:02:23 pm »
I have two lightguns and will test it for you. What information do you actually need?

Howard_Casto

  • Idiot Police
  • Trade Count: (+1)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 16758
  • Your Post's Soul is MINE!!! .......Again??
    • The Dragon King
Re: Sega Model 2 Emulator Full Screen Shooter fix - RamjetM2Borderless - App
« Reply #109 on: January 23, 2013, 07:32:01 pm »
You don't really need two as I'm reading only the first two mice on your system.  The first will be the actual mouse and the second will be your first lightgun. 


I just need to you check things visually to see if they are working right.  In other words fire a few shots and see if the cursors I made go where they are supposed to and if not how to they behave, ect.....

Endprodukt

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 619
  • I want to build my own arcade controls!
AW: Sega Model 2 Emulator Full Screen Shooter fix - RamjetM2Borderless - App
« Reply #110 on: January 23, 2013, 07:55:21 pm »
Tried it out but it didn't work as expected. Problem could be that the gun isn't mouse 2 on my system because of my trackball and spinner. Coordinates do change though while moving the gun . Disconnecting the spinner and trackball didn't help either.

vandale

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 318
  • Id 10 and t error
Re: Sega Model 2 Emulator Full Screen Shooter fix - RamjetM2Borderless - App
« Reply #111 on: January 23, 2013, 08:22:36 pm »
Hi guys.

I have been using a glovepie script called MouseParty which allows 4 mice on windows 7. If I edit the script down to 2 mice assigned to device 0 and 6 (usb mouse and macbook touchpad) then assign those devices in the M2 ini, I then get control over both red and blue cross hairs and can play 2 player independantly with trigger, reload and scores working correctly on each player.

Two real mice (or touchpads) have always worked.  The rawinput M2 uses from real mice is "relative" meaning it only knows which direction and how far the mouse moves, but doesn't know where it started or where it is in space.  The mouse is incapable of reporting exactly where it is, only direction and distance.  You can pick it up and set it down in a different place on the desk and it makes no difference.

For guns, we need to know the "absolute" position where the gun is pointed.  Just knowing how far and what direction it moved doesn't work because M2 doesn't know where it started.  Even if you started the game with the gun pointed directly center every time, when you go offscreen, it would get screwed up.  It doesn't matter with mice or touchpads because you're not aligning them with anything on the screen.

Howard is attempting to do something similar to the original Troubleshooter program (whose author has been MIA for many years).
Here is a page that explains the issue and how the solution works:
http://thetroubleshooter.home.mindspring.com/howitworks.htm


There was a company that showed a "coffee table" pc recently with a huge touchscreen that multiple people could use at once.
I think it ran a custom version of windows 8.  So there's hope that future versions of windows will do away with only having one system mouse.

Hi Badmouth. I understand that for light guns but I am only wanting to use Wiimotes so acuracy is not an issue as I use the cross hair to line up the shot anyway. Howards Wiimote script has good calibration feature and it is very accurate on my setup so using the cross hairs that are already built into M2 will work a treat for my setup.

So my thinking was if mouse party worked fine on my two mouse devices then a simple 2 mouse wiimote script mashed together with Howards mame script would be sufficient. Obviously this doesnt work for act labs etc.

So my needs are somewhat different than what you guys are actually trying to acheive. Good work on progress so far though.

Howard, do you know of a dual mouse wiimote script that allows you to assign what input ID you have hijacked? I have searched high and low and oly come up with singles.
Thanks
Gene

TIGER8855

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 66
  • I want to build my own arcade controls!
Sega Model 2 Emulator Full Screen Shooter fix - RamjetM2Borderless - App
« Reply #112 on: January 23, 2013, 09:07:42 pm »
Howard,

There is a whole heap of FF data not just from the wheel but the entire car axis, yaw, acceleration forces available in the struct around the rpm and speed information I extract for the Symprojects dashboard in my cabinet. That's how I get the data out for xsim to display my Speedometer in Daytona and Sega Rally. I haven't explained any of this information that my current VR program gathers because it at the time was all surplus to anyone who wanted purely to emulate the original ROM on original hardware?

Ramjet

Slightly off topic but does anyone have a link to theRamjetR VR program for use with model 2? I had a link to it previously but the link is now dead.

BadMouth

  • Trade Count: (+6)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 8415
  • ...
Re: Sega Model 2 Emulator Full Screen Shooter fix - RamjetM2Borderless - App
« Reply #113 on: January 23, 2013, 09:17:51 pm »
Had a change of plans and was able to do some testing with a pair of Act Labs and a single Aim-Trak.
Uploading shaky video to youtube now, but it's taking forever.

BadMouth

  • Trade Count: (+6)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 8415
  • ...
Re: Sega Model 2 Emulator Full Screen Shooter fix - RamjetM2Borderless - App
« Reply #114 on: January 23, 2013, 09:28:50 pm »
So my needs are somewhat different than what you guys are actually trying to acheive.

Actually, what they are trying to acheive is more relevant to Wii controllers, than Act Labs guns.
I'm the odd man out with the old CRT guns. 

BadMouth

  • Trade Count: (+6)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 8415
  • ...
Re: Sega Model 2 Emulator Full Screen Shooter fix - RamjetM2Borderless - App
« Reply #115 on: January 23, 2013, 10:12:34 pm »
All apologies for the video quality.   I should have thought to reduce the resolution to 640x480 to make the numbers more legible.
I will in future tests.

On my laptop, the blue and red blocks are controlled separately by the touchpad and mouse, and track in an expected, controlled manner.

Round 1: two act labs guns - blue block jump to the position the mouse clicked on the command button, but otherwise doesn't move.
Red block disappears (assuming it flies offscreen)
vbx & vby register numbers when trigger is held and snap back to zero when trigger is released.

Act Labs rawtest 1


Round 2: more of the same with two act labs guns

Act Labs rawtest 2


Round 3: Aim-Trak (while act labs guns still plugged in)

AimTrak rawtest 1


Round 4: No video (done while other videos were uploading)  Trackball and Aim-Trak, Act Labs guns unplugged.
              Aim-Trak behaves same as last video.  Trackball controlls red square in expected controlled manner.

If you need me to get some specific numbers or something, just let me know.

Howard_Casto

  • Idiot Police
  • Trade Count: (+1)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 16758
  • Your Post's Soul is MINE!!! .......Again??
    • The Dragon King
Re: Sega Model 2 Emulator Full Screen Shooter fix - RamjetM2Borderless - App
« Reply #116 on: January 23, 2013, 11:14:18 pm »
Ok that's helpful and very interesting, thanks. 


Notice the lLastX and lLastY values?  They are in the 6 digits with those guns hooked up.  On my machine with a regular old mouse, any movement would be like +1 for about a pixel or +8 for a really big movement.

In other words, all the guns, even the aimtrack are giving absolute mouse positions.    This is actually a good thing!  It makes things much easier for me.  Now we simply need to determine the data format.  Could be Mickeys, could be twips, could be CPI (the mouse equivelent of dpi).  ONce we get that I can tack on a multiplier and they should track properly.  As for trackballs and real mice, I'm not particularly concerned.  They just nudge the cursor anyway so I can setup a user-defined multiplier for them.  I can't replicate how a windows cursor behaves anyway, they have "mouse ballistics" applied to them to make movement smoother. 

I'll look up some match functions and add those for the next go. 

Howard_Casto

  • Idiot Police
  • Trade Count: (+1)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 16758
  • Your Post's Soul is MINE!!! .......Again??
    • The Dragon King
Re: Sega Model 2 Emulator Full Screen Shooter fix - RamjetM2Borderless - App
« Reply #117 on: January 23, 2013, 11:49:32 pm »
Ok give this bad boy a shot. 

I've removed the generic multiplier I had on the absolute tracking, hopefully that'll keep the cursor from disappearing. 

I've also wrote a bit of code to show you your screen dimesnions in different formats.  Hopefully with that we can determine which format it's using. 

vandale

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 318
  • Id 10 and t error
Re: Sega Model 2 Emulator Full Screen Shooter fix - RamjetM2Borderless - App
« Reply #118 on: January 24, 2013, 03:08:35 am »
Ok give this bad boy a shot. 

I've removed the generic multiplier I had on the absolute tracking, hopefully that'll keep the cursor from disappearing. 

I've also wrote a bit of code to show you your screen dimesnions in different formats.  Hopefully with that we can determine which format it's using.

My mouse moves the red square and my touchpad moves the right square. How would I get the 2 wiimotes to control these squares independently?
Thanks

Howard_Casto

  • Idiot Police
  • Trade Count: (+1)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 16758
  • Your Post's Soul is MINE!!! .......Again??
    • The Dragon King
Re: Sega Model 2 Emulator Full Screen Shooter fix - RamjetM2Borderless - App
« Reply #119 on: January 24, 2013, 01:22:34 pm »
You wouldn't....  you should read my post above about how you CANNOT fake dual mice.  This is for reading actual mice-based devices. 

BadMouth

  • Trade Count: (+6)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 8415
  • ...
Re: Sega Model 2 Emulator Full Screen Shooter fix - RamjetM2Borderless - App
« Reply #120 on: January 24, 2013, 08:03:56 pm »
New rawtest:

Interesting thing was that if I kept the guns aimed in the extreme upper lefthand corner, the x and y coordinates would stay low enough to have the red box on-screen and tracking.

Aim-Trak on 1440x900 LCD
Rawtest2 Aim-Trak


Act Labs on 800x600 CRT TV over S-Video
rawtest2 Act Labs

(After the video I restarted the PC, re-calibrated gun #2 and it behaved the same as the first and I was able to get the red cursor back on screen with it)

I know this is just a test app, but one thing bugs me.
When we use real mice or track pads, each one control a different cursor(red and blue) independently.
But when we use guns or guns in combination with a single mouse, they both control the red cursor.
What's going on?

Howard_Casto

  • Idiot Police
  • Trade Count: (+1)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 16758
  • Your Post's Soul is MINE!!! .......Again??
    • The Dragon King
Re: Sega Model 2 Emulator Full Screen Shooter fix - RamjetM2Borderless - App
« Reply #121 on: January 24, 2013, 09:16:03 pm »
Ok this is all good stuff. 

It's hard to read numbers from videos but am I to assume that the values you get at the bottom right corner are in the ballpark of 65535 ?

Because this is the magic constant conversion number for mickeys according to microsoft.  So I have the right info, I just didn't understand how it's supposed to be used. 

Apparently the absolute position is a field of mickeys.  In other words 0 to 65535 for the width and 0 to 65535 for the height.  Extremely confusing considering monitors aren't square, but whatever. 

So to get the pixel position I would divide the numbers by 65535 and then multiply by the screen width or height respectively. 

I"ll whip that up in a second and post it. 

Howard_Casto

  • Idiot Police
  • Trade Count: (+1)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 16758
  • Your Post's Soul is MINE!!! .......Again??
    • The Dragon King
Re: Sega Model 2 Emulator Full Screen Shooter fix - RamjetM2Borderless - App
« Reply #122 on: January 24, 2013, 09:25:43 pm »
Here you go.  P2 wasn't coded properly last version btw... sorry about that. 

As for why the dual act-labs guns show up as one mouse... well they were designed that way.  If I remember my ancient history correctly the pc guns came out first, and they were for... well pc games.  Since pc games didn't support two mice it was assumed that people would only want one gun.  MAME changed all of that and by the time the svid guns came out they had did a hardware cludge to detect the different guns by giving player 2 buttons that fired mouse buttons 3 and 4.  The original troubleshooter used the hardware id to detect different button presses, not position changes of the indiviual mice.    Anyway I'm not sure what it's all about, but basically they acted as one mouse. 

Now if the aimtrack guns are behaving this way we are in trouble, but if it's true lightguns then it's no big deal, I can code for that. 

BadMouth

  • Trade Count: (+6)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 8415
  • ...
Re: Sega Model 2 Emulator Full Screen Shooter fix - RamjetM2Borderless - App
« Reply #123 on: January 24, 2013, 09:39:52 pm »
Here you go.  P2 wasn't coded properly last version btw... sorry about that. 

As for why the dual act-labs guns show up as one mouse... well they were designed that way.  If I remember my ancient history correctly the pc guns came out first, and they were for... well pc games.  Since pc games didn't support two mice it was assumed that people would only want one gun.  MAME changed all of that and by the time the svid guns came out they had did a hardware cludge to detect the different guns by giving player 2 buttons that fired mouse buttons 3 and 4.  The original troubleshooter used the hardware id to detect different button presses, not position changes of the indiviual mice.    Anyway I'm not sure what it's all about, but basically they acted as one mouse. 

Now if the aimtrack guns are behaving this way we are in trouble, but if it's true lightguns then it's no big deal, I can code for that.

AimTrak gun and mouse were hooked up in the first test.  Both controlled the red cursor.  :-\

will test this version with the aim-trak right now.

BadMouth

  • Trade Count: (+6)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 8415
  • ...
Re: Sega Model 2 Emulator Full Screen Shooter fix - RamjetM2Borderless - App
« Reply #124 on: January 24, 2013, 09:55:26 pm »
Ok, most of the time both mice control the red pointer, but twice in about five launches, it worked at it should with the aim-track controlling the red and the mouse controlling the blue.  I'll do some more testing and see if I can find any rhyme or reason.

To keep the red pointer on the screen, I need to keep the x coordinate under around 4400 and the y under 4000.
It's hard to get exact numbers because it's so jumpy.  Uploading pics shortly since youtube was taking so long to upload vids earlier.

BadMouth

  • Trade Count: (+6)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 8415
  • ...
Re: Sega Model 2 Emulator Full Screen Shooter fix - RamjetM2Borderless - App
« Reply #125 on: January 24, 2013, 10:01:10 pm »
pic attached

I'll mess with this for a bit longer and see if I can figure out the difference between the times that the mouse countrols the blue cursor and when it controls the red one that the AIM Trak is already controlling.

The S-Video and newer act labs guns do show up as separate mice BTW.
It was only the first generation VGA guns that made P2's trigger and button show up as buttons 3 and 4 on the same mouse.
Doubt I'll have time tonight, but I suspect if I did more than a couple rounds of testing, they would each control a different pointer about the same percentage of time as the aim-trak and mouse on the other computer.
« Last Edit: January 24, 2013, 10:06:01 pm by BadMouth »

BadMouth

  • Trade Count: (+6)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 8415
  • ...
Re: Sega Model 2 Emulator Full Screen Shooter fix - RamjetM2Borderless - App
« Reply #126 on: January 24, 2013, 10:22:47 pm »
If I use the real mouse to click the command button, then it controls the red and the Aim-Trak also controls the red.  Neither moves the blue.

If I use the Aim-Trak to click the command button,  then it controls the red and the real mouse controls the blue.

If I just press Enter to click the command button, then the Aim-Track controls the red and the real mouse controls the blue.

When I was working with the Act Labs guns, I used gun 1 to move the mouse pointer to the command button, then pressed enter (and they both controlled red).  Maybe if I switch guns around?...

At any rate, it's predictable and it does work properly if certain conditions are met.

Howard_Casto

  • Idiot Police
  • Trade Count: (+1)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 16758
  • Your Post's Soul is MINE!!! .......Again??
    • The Dragon King
Re: Sega Model 2 Emulator Full Screen Shooter fix - RamjetM2Borderless - App
« Reply #127 on: January 24, 2013, 10:30:39 pm »
Ok I had a Senior moment... did the math backwards in that last one and that's why the cursor was still going off the screen. 

This one should fix that give or take a few pixels because there isn't a calibration routine. 

If you've got another mouse hooked up that's the issue right there. 

I'm just controlling the first two mice found... not the first two lightguns or any special conditions.  Later on I'll look for the actual hardware names and do it properly, but I'd have to KNOW the proper hardware names first... thus the reason I just did the first two mice. I know the act labs guns in particular do some rather funky stuff to the system mouse.

Howard_Casto

  • Idiot Police
  • Trade Count: (+1)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 16758
  • Your Post's Soul is MINE!!! .......Again??
    • The Dragon King
Re: Sega Model 2 Emulator Full Screen Shooter fix - RamjetM2Borderless - App
« Reply #128 on: January 24, 2013, 10:39:58 pm »
Oh btw, the mysterous "command 2" is just a math test with a hypothetical mickey value.  If you press it you'll get a message box that shows roughly half the pixel width of your screen. 

BadMouth

  • Trade Count: (+6)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 8415
  • ...
Re: Sega Model 2 Emulator Full Screen Shooter fix - RamjetM2Borderless - App
« Reply #129 on: January 24, 2013, 10:46:04 pm »
There are only two mice hooked up to this PC.  A USB wireless one and the Aim-Trak.  No others.

 I think we went too far in the other direction.   :lol

The cursor doesn't move more than a couple inches away from the top left corner.
In the attached pic, the gun was moved all the way off the bottom right of the screen.
The cursor moves in relation to the gun, just not very far.

BYOAC is pitching a fit about the pic sizes (even though the last one should have been the same size)
I'll edit this post and attach them after I get them resized.
« Last Edit: January 24, 2013, 10:48:19 pm by BadMouth »

Howard_Casto

  • Idiot Police
  • Trade Count: (+1)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 16758
  • Your Post's Soul is MINE!!! .......Again??
    • The Dragon King
Re: Sega Model 2 Emulator Full Screen Shooter fix - RamjetM2Borderless - App
« Reply #130 on: January 24, 2013, 11:13:27 pm »
Yeah two message boxes should pop up.  The first shows what you showed, which is basically 32767 / 65535 or roughly half the screen in mickeys.  After you press ok, a second box will show up, which is half the screen in pixels or in your case about 720. 

I can try one more thing, namely to remove the vb twips mode, which eliminates one of the conversions.  Hold on a sec....

Howard_Casto

  • Idiot Police
  • Trade Count: (+1)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 16758
  • Your Post's Soul is MINE!!! .......Again??
    • The Dragon King
Re: Sega Model 2 Emulator Full Screen Shooter fix - RamjetM2Borderless - App
« Reply #131 on: January 24, 2013, 11:16:26 pm »
Ok, last one for tonight.  This hopefully should do it .....stupid twips ruin everything. 

BadMouth

  • Trade Count: (+6)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 8415
  • ...
Re: Sega Model 2 Emulator Full Screen Shooter fix - RamjetM2Borderless - App
« Reply #132 on: January 24, 2013, 11:32:36 pm »
Ok, last one for tonight.  This hopefully should do it .....stupid twips ruin everything.

Tracks perfect! (as good as it gets for IR guns)

One odd behavior, but it may be hardware, IR LED reflecting off of something.
When I move the gun off the right side of the screen, the cursor will jump back onto the screen a few inches from the edge.
I can still control it, even though the gun is pointed off-screen.  If I continue moving the gun right, it goes off the screen again (and doesn't jump back).

Someone needs to try this with two Aim-Traks and no mice hooked up.
If both guns control the same cursor, relaunch the program and just use enter to push the command button,
or try using the other gun to click the command button.

Actually relieved it's the last one....need sleep.
I will test it with the act labs guns tomorrow, but probably won't have time to do any more.

Howard_Casto

  • Idiot Police
  • Trade Count: (+1)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 16758
  • Your Post's Soul is MINE!!! .......Again??
    • The Dragon King
Re: Sega Model 2 Emulator Full Screen Shooter fix - RamjetM2Borderless - App
« Reply #133 on: January 24, 2013, 11:39:56 pm »
Excellent!  And with that I can put this code into the troubleshooter. 

I wouldn't worry about the ID thing.  In the real app you'll get a drop-down box with a list of the mice on your system you can select from.  We might still have some strange issues with the act-labs guns due to the things I discussed before, but as I said, they are fixable. 


Thanks for all the work man... I know it's a pain in the butt to play the back and forth game like this. 

Endprodukt

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 619
  • I want to build my own arcade controls!
Re: Sega Model 2 Emulator Full Screen Shooter fix - RamjetM2Borderless - App
« Reply #134 on: January 25, 2013, 05:11:03 am »
This is so exciting... feels like you're almost there :)

BadMouth

  • Trade Count: (+6)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 8415
  • ...
Re: Sega Model 2 Emulator Full Screen Shooter fix - RamjetM2Borderless - App
« Reply #135 on: January 25, 2013, 06:19:31 pm »
Last rawtest with Act Labs guns:

Red pointer snaps to where the gun is pointed when the trigger is pulled.
Pretty close to dead on perfect when firing centered or to the left,
but seems to start going right as I move toward the right side of the screen.
(not something that concerns us now)

Unfortuneately both guns only control the red pointer no matter what I do.
Neither one moves the blue pointer.
No other mice are hooked up.

The device ID at the top does change depending on which trigger is pulled.
If there are any more tests I can do that would be helpful, let me know.
It will probably be tomorrow morning before I can get to it though.

Howard_Casto

  • Idiot Police
  • Trade Count: (+1)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 16758
  • Your Post's Soul is MINE!!! .......Again??
    • The Dragon King
Re: Sega Model 2 Emulator Full Screen Shooter fix - RamjetM2Borderless - App
« Reply #136 on: January 25, 2013, 07:28:12 pm »
Well the device id being different when the trigger is pulled is all I need for true lightguns.  I can read the sysmouse position when the trigger is pulled and apply it to that particular gun's position.... easy as cake.  Even if by some odd chance both users pressed the triggers at the same time, both individual "event fired" messages would come into the function, so I'd read for p1, then read for p2. 

Not M2 related, but I wanted to see if  the values in the original troubleshooter's ini would be useful to me.  The only game I have on the list (on this pc anyway) is HOTD3 and I plugged in the values for p1x and they tracked as expected!  I looked through the ini to see how the various games are tracked and the only one that looks like it might be an issue would be die hard.  With all due respect to the die hard fans, I'm not wasting my time supporting that cruddy game considering it looks like you have to do a full on dx dll hook. 


Howard_Casto

  • Idiot Police
  • Trade Count: (+1)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 16758
  • Your Post's Soul is MINE!!! .......Again??
    • The Dragon King
Re: Sega Model 2 Emulator Full Screen Shooter fix - RamjetM2Borderless - App
« Reply #137 on: January 25, 2013, 11:29:45 pm »
Something I just wanted to point out, because it confused me a bit but I hadn't really looked into this. 

For all gun games in model 2, p1 trigger is mapped to player 1 button 1 in the cfg menu.  Player 2's trigger is mapped to PLAYER1 button 2. 

Now we will be hacking in the input status but I just thought I would put it out there. 

Endprodukt

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 619
  • I want to build my own arcade controls!
AW: Sega Model 2 Emulator Full Screen Shooter fix - RamjetM2Borderless - App
« Reply #138 on: January 26, 2013, 05:23:56 am »
What about demul support ? That would be nice.

RamjetR

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 144
    • My Youtube Channel
Re: Sega Model 2 Emulator Full Screen Shooter fix - RamjetM2Borderless - App
« Reply #139 on: January 26, 2013, 06:04:51 am »
Demul are still in active development aren't they?? Surely they can add their own support easier than what we're trying to do...
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

Howard_Casto

  • Idiot Police
  • Trade Count: (+1)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 16758
  • Your Post's Soul is MINE!!! .......Again??
    • The Dragon King
Re: Sega Model 2 Emulator Full Screen Shooter fix - RamjetM2Borderless - App
« Reply #140 on: January 26, 2013, 05:09:49 pm »
Yeah this is for dead emus (like m2) or emus that have such a restrictive liscense agreement that they won't allow me to add proper windows message code (like daphne). 

It'll have other uses as well.

Howard_Casto

  • Idiot Police
  • Trade Count: (+1)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 16758
  • Your Post's Soul is MINE!!! .......Again??
    • The Dragon King
Re: Sega Model 2 Emulator Full Screen Shooter fix - RamjetM2Borderless - App
« Reply #141 on: January 26, 2013, 06:14:11 pm »
Minor progress today.  Lua is kind of poorly documented imho, so I have to kind of poke around to get it what I want it to do. 

Figured out how to write to a specific path today.  The slashes are backwards to what windows users are used to, probably due to lua's multi-platform support. 

so 'c:\test\output.txt' becomes 'c:/test/output.txt'

I can use this to have the scripts write the dynamic memory addresses directly to my troubleshooter.  That's just the easiest way atm. 


I need to find out if the same trick works for the shell command.  The idea is upon init I'll have the script first write the text file containing the addresses, then I'll shell troubleshooter itself with the proper command line.  Since the text file is written first, it assures me that the file is up to date and eliminates the need to constantly check it. 

**update**

I wrote a test app to see what method lua uses to launch exes.  Fortunately it DOES set the working path when an exe outside of the current path is launched, which means that the method I described above will work just fine. 
« Last Edit: January 26, 2013, 06:22:04 pm by Howard_Casto »

Endprodukt

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 619
  • I want to build my own arcade controls!
AW: Sega Model 2 Emulator Full Screen Shooter fix - RamjetM2Borderless - App
« Reply #142 on: January 26, 2013, 09:26:43 pm »
I don't understand anything but it sounds like your methods could work. That's what matters. Thanks for doing this work to all who are involved.

Howard_Casto

  • Idiot Police
  • Trade Count: (+1)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 16758
  • Your Post's Soul is MINE!!! .......Again??
    • The Dragon King
Re: Sega Model 2 Emulator Full Screen Shooter fix - RamjetM2Borderless - App
« Reply #143 on: January 27, 2013, 02:47:16 am »
Spent a minute or two tonight teaching myself a little more lua. 

This time I learned how to read lines from a text file and apply them to a script.  Since the lua scritps will be launching the troubleshooter and not the other way around, I thought it might be useful to a a user configurable file to set the path where the troubleshooter is instead of forcing them to rummage through the scripts.  On  a somewhat related note, string contatination in LUA is *almost* as bad is it is in straight C. 

And people wonder why most of my stuff is in vb.  ;)

Endprodukt

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 619
  • I want to build my own arcade controls!
Re: Sega Model 2 Emulator Full Screen Shooter fix - RamjetM2Borderless - App
« Reply #144 on: January 27, 2013, 12:04:57 pm »
if you need someone for testing I'm in!

BadMouth

  • Trade Count: (+6)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 8415
  • ...
Re: Sega Model 2 Emulator Full Screen Shooter fix - RamjetM2Borderless - App
« Reply #145 on: January 27, 2013, 07:37:30 pm »
if you need someone for testing I'm in!

Do you have two aim-traks?
Give Howard's last rawtest will work with two aim-traks.
I only had a single aim-trak and mouse connected.

There was an issue in my testing where if I used the real mouse to click the command button, both would control the red cursor and neither would control the blue.  If I used the gun or the enter key, each would control a different color.

It would be good to know that they control the two cursors independently.
Might not be of as much use to Howard at this point, but I'm curious and it will only take a couple minutes to test.
If they both control the same cursor, try using the other gun to click command the next time.


Endprodukt

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 619
  • I want to build my own arcade controls!
AW: Sega Model 2 Emulator Full Screen Shooter fix - RamjetM2Borderless - App
« Reply #146 on: January 28, 2013, 03:14:03 am »
Will do that today. :)

Endprodukt

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 619
  • I want to build my own arcade controls!
Re: Sega Model 2 Emulator Full Screen Shooter fix - RamjetM2Borderless - App
« Reply #147 on: January 28, 2013, 12:42:08 pm »
here are my results:

pressing return: gun 1 moves red, mouse moves blue

pressing command with gun 1: red will disappear, blue can't be moved with gun 1/2 or mouse

pressing command with gun 2: mouse will move blue, gun 1 and gun 2 will move two flickering red squares (seperate from each other.)

pressing command with mouse: same as pressing with gun 2.

pressing command with trackballs mouse: same as pressing with gun 2.

Howard_Casto

  • Idiot Police
  • Trade Count: (+1)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 16758
  • Your Post's Soul is MINE!!! .......Again??
    • The Dragon King
Re: Sega Model 2 Emulator Full Screen Shooter fix - RamjetM2Borderless - App
« Reply #148 on: January 28, 2013, 12:48:34 pm »
This is how it should behave according to my code.  You will be able to manually select the mouse devices in the actual app so this is NOT an issue. 

Thanks for testing!

Endprodukt

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 619
  • I want to build my own arcade controls!
Re: Sega Model 2 Emulator Full Screen Shooter fix - RamjetM2Borderless - App
« Reply #149 on: January 28, 2013, 01:12:53 pm »
Great! Want to help as much as I can for something I'm so much looking forward to!

Is there any chance of estimating a first release? I have no idea how much work it takes to code this. Are we talking about days/weeks/moths?

Thanks again for doing this.

ArcadeBliss

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 161
Re: Sega Model 2 Emulator Full Screen Shooter fix - RamjetM2Borderless - App
« Reply #150 on: January 28, 2013, 03:36:51 pm »
Thanks guys! I am so looking forward to this. let me know if you need any more tests. I have two Aimtraks and an Opti-pac :)

Howard_Casto

  • Idiot Police
  • Trade Count: (+1)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 16758
  • Your Post's Soul is MINE!!! .......Again??
    • The Dragon King
Re: Sega Model 2 Emulator Full Screen Shooter fix - RamjetM2Borderless - App
« Reply #151 on: January 28, 2013, 04:06:18 pm »
Is there any chance of estimating a first release? I have no idea how much work it takes to code this. Are we talking about days/weeks/moths?

Well back in the day I would automatically delay a release by one day every time somebody asked that.  ;)

Seriously though It'll be done when it's done.  I'm working on it at least a little every day. 

Endprodukt

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 619
  • I want to build my own arcade controls!
Re: Sega Model 2 Emulator Full Screen Shooter fix - RamjetM2Borderless - App
« Reply #152 on: January 28, 2013, 04:45:13 pm »
haha, I guess that's the answer I deserved... sorry for beeing so impatient. Please don't delay the release because I was so stupid and asked :D  :banghead:

RamjetR

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 144
    • My Youtube Channel
Re: Sega Model 2 Emulator Full Screen Shooter fix - RamjetM2Borderless - App
« Reply #153 on: January 28, 2013, 09:54:11 pm »
Heya, Sorry I haven't been much help lately. If your not up with international news, Australia has been ravaged with 56degreeC heat and bush fires one week and now cyclone and severe flooding this week. I've spent the last 4 days rectifying power outages and restoring radio and microwave communications in 110kph+ winds and rain the likes I've never seen before. I'm still on call till Thursday and I'm sure it won't ease till then...

I'll try to get the M2 X/Y inhibit code operational globally for all the shooters this weekend provided I get power restored to my own house. Here's hoping my new house doesn't go underwater either... apparently the water was lapping the bottom of the driveway yesterday... which scares the buggery out of me as I planned to by my arcade machines in that garage... :S The rest of the town I currently live in was evactuated last night and I'm just watching water swallow the houses below me... it's pretty wild stuff...

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

Howard_Casto

  • Idiot Police
  • Trade Count: (+1)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 16758
  • Your Post's Soul is MINE!!! .......Again??
    • The Dragon King
Re: Sega Model 2 Emulator Full Screen Shooter fix - RamjetM2Borderless - App
« Reply #154 on: January 28, 2013, 10:25:51 pm »
Sorry to hear that man. 

I've been cleaning up the code and it's become apparent that if we don't find a way to properly hook these addresses instead of simply writing to them this isn't going to work.  Upon cleaning up my code the crosshair manipulation suddenly stopped working.  It became apparent that the reason is the new code is *slighty* slower and this decrease in speed made the function to slow to overwrite the values even though the function is an infinate loop that CONSTANTLY overwrites the values.  My machine is a beast btw... it probably wouldn't run even with the old code on a lesser machine. 


I found some vb code for an app that does some low-level hooking.... I would say it looks promising, but I've yet to get it to actually hook anything yet (it does show me the addresses of all the api calls from m2, such as getcursorposition). 

RamjetR

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 144
    • My Youtube Channel
Re: Sega Model 2 Emulator Full Screen Shooter fix - RamjetM2Borderless - App
« Reply #155 on: January 28, 2013, 10:56:56 pm »
You were hooking in with writeprocessmemory weren't you? How about we take more of a closer look doing this inside the Model 2 emulator itself. What I've been doing in the rare 20mins I have spare here and there as part of reverse engineering the emulator writing the code to the in game axis, is analyzing the code from other ROMs which are accessing joystick inputs and where it's pulling the data from and using parts of that code to inject into the running process of the shooters. Now there is a bit to isolate but with it running in the current process as a trainer, I can do the mouse update halt and code jump to joystick code and return. Thats how I got the code reference for stopping the x/y updates to enable your code injection to work without being hindered by the emulator. I suppose you could call it working on the otherside of the API calls from the emulator side rather than the OS side lol?


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

Howard_Casto

  • Idiot Police
  • Trade Count: (+1)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 16758
  • Your Post's Soul is MINE!!! .......Again??
    • The Dragon King
Re: Sega Model 2 Emulator Full Screen Shooter fix - RamjetM2Borderless - App
« Reply #156 on: January 28, 2013, 11:48:21 pm »
All I really need to know is the addresses to the functions in m2 where it goes to set the variables we want to change so I can disable them. 

Maybe you sent me the wrong cheat file before, but turning it into a nop didn't have any effect nor did "freezing" it.  So I don't think we are on the same page as to what you are doing. 

I can set the memory to read only, but that could crash m2 depending upon it's error handling.  I have other options on my end that I can do, but the more low-level I go, the more chance of a massive crash or memory leak. 

vandale

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 318
  • Id 10 and t error
Re: Sega Model 2 Emulator Full Screen Shooter fix - RamjetM2Borderless - App
« Reply #157 on: January 29, 2013, 01:10:45 am »
Heya, Sorry I haven't been much help lately. If your not up with international news, Australia has been ravaged with 56degreeC heat and bush fires one week and now cyclone and severe flooding this week. I've spent the last 4 days rectifying power outages and restoring radio and microwave communications in 110kph+ winds and rain the likes I've never seen before. I'm still on call till Thursday and I'm sure it won't ease till then...

I'll try to get the M2 X/Y inhibit code operational globally for all the shooters this weekend provided I get power restored to my own house. Here's hoping my new house doesn't go underwater either... apparently the water was lapping the bottom of the driveway yesterday... which scares the buggery out of me as I planned to by my arcade machines in that garage... :S The rest of the town I currently live in was evactuated last night and I'm just watching water swallow the houses below me... it's pretty wild stuff...

Ramjet

wow! Sorry to hear. Ive been watching the news here in NZ. Reminds me of the horrific time we had in the Christchurch earth quakes a few years back, moved the hell away from there in a hurry!

Bring on Thursday

Howard_Casto

  • Idiot Police
  • Trade Count: (+1)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 16758
  • Your Post's Soul is MINE!!! .......Again??
    • The Dragon King
Re: Sega Model 2 Emulator Full Screen Shooter fix - RamjetM2Borderless - App
« Reply #158 on: January 29, 2013, 01:14:31 am »
You were looking for stuff via emulator.exe.... I was looking for stuff via emulator_multicpu.exe, apparently there is a difference.  ;)

I did find some more locations for NOP insertion that worked for me. Once NOPed my app did work as it should.  Now If I could only figure out how the heck to manually make a trainer from the cheat engine... or figure out WTF their addresses are. 

Howard_Casto

  • Idiot Police
  • Trade Count: (+1)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 16758
  • Your Post's Soul is MINE!!! .......Again??
    • The Dragon King
Re: Sega Model 2 Emulator Full Screen Shooter fix - RamjetM2Borderless - App
« Reply #159 on: January 29, 2013, 06:16:26 pm »
Well it's time for me to take a break as well.  It's been 70 degrees here one day and 20 the next.  My pipes decided they didn't like that so I've been fighting them all day.  And it's supposed to be below freezing by tomorrow night (even though it's 72 now) and I've got a bunch of exposed pipes with no insulation on them.  Looks like we are going to get some of those crazy winds you were talking about over here in the States as well.  Weather, as a whole, seems to be screwed up anymore. 

I hope things get better in your neck of the woods Ramjet.  I realized this evening that my posts make it seem like I'm disinterested, it's just that's the types of posts you'll get from me at 4am when I'm having trouble sleeping.  ;)

Howard_Casto

  • Idiot Police
  • Trade Count: (+1)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 16758
  • Your Post's Soul is MINE!!! .......Again??
    • The Dragon King
Re: Sega Model 2 Emulator Full Screen Shooter fix - RamjetM2Borderless - App
« Reply #160 on: January 30, 2013, 03:28:00 am »
Man insomnia sucks.  Even when you know you have stuff to do the next day, when you can't sleep you just can't sleep!

Anyway, I did just a little more work on the troubleshooter.  I've added support for reading addresses off of a csv file.  I added this specific for model2 because suprisingly other games/emulators aren't nearly as difficult to work with.  What does this mean?   Well RamJet's excellent scripts for daytona can now be replaced with the troubleshooter.  I wrote a simple script that prints out all the needed dynamic addresses to a csv file when daytona starts.  It seems to work pretty well although I have to add a delay of a second or two before it starts up to give model 2 a change to write the file.  Unlike the current script the file only has to be read once, so it should be easier on the harddrive.  This should be useful for problem addresses with the guns as well.  I can print out an address if it's dynamic. 

On that note I've been wondering if we are going about the solution the wrong way in regards to the guns.  We've been messing with the RAM to insert a NOP command, but if cheat engine is modifying the assembly code doesn't that mean we could simply hack the exe?  I haven't looked into it but I think ramjet is more intune to the lower level programming languages so I thought I would mention it. 

Endprodukt

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 619
  • I want to build my own arcade controls!
AW: Sega Model 2 Emulator Full Screen Shooter fix - RamjetM2Borderless - App
« Reply #161 on: January 30, 2013, 06:21:09 am »
I'm suffering from insomania as well to a point were it controlled my life. Therapy, medication, sports can help as long as you're not relying on one solution. I'm still up way too long, like 2-3 am and have to get up at 7 to get to work. Another important thing is not to force you're sleep. Its way more important to have a few hours of good sleep rather than forcing sleep under pressure. Some kind of endurance sports are the best you can do in my opinion. Running fast  for 20 minutes in the evening helped me a lot. If you all ready know all that I'm sorry.

Howard_Casto

  • Idiot Police
  • Trade Count: (+1)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 16758
  • Your Post's Soul is MINE!!! .......Again??
    • The Dragon King
Re: Sega Model 2 Emulator Full Screen Shooter fix - RamjetM2Borderless - App
« Reply #162 on: January 30, 2013, 03:17:59 pm »
Yeah I've tried it all, but I still have trouble sleeping sometimes.  Thanks for you concern though. 

Well even though I said I was going to take a break I found myself with some free time today so I thought I would plug along some more.  Model 2 stuff was getting on my nerves because of it's complexity so I thought I would start working on adding support for all the pc games in the old troubleshooter app into this one.  That part is suprisingly easy!  I plugged in the values for House of the Dead 3 and troubleshooter immediately worked with the game, no issues whatsoever.  I was a little concerned because HOTD3 uses float values to store the gun positions and vb technically doesn't have a float variable type.  Luckily the single data type works just fine for this. 

One thing I need to add in that I just haven't messed with yet is key simulation.  The old troubleshooter simply simulates keypresses to press the fire and reload buttons in games.  Since this works and I don't want to have to search memory addresses to do it the "right way" I went ahead and pulled in my now 13+ year old code for keypress simulation from the first wrapper I ever released.  Still works great!  I wish I could do this for model 2, but alas it doesn't work with m2... it's just picky. 


So except for model 2 ironically, things are going pretty smoothly.  What I'm going to do is this:  I'll add in code for a NOP section in the ini files for the games.  If/When we ever figure out the regions to NOP in m2 to make it cooperate, we can just plug in the values. 

RamjetR

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 144
    • My Youtube Channel
Re: Sega Model 2 Emulator Full Screen Shooter fix - RamjetM2Borderless - App
« Reply #163 on: January 31, 2013, 04:10:39 am »

On that note I've been wondering if we are going about the solution the wrong way in regards to the guns.  We've been messing with the RAM to insert a NOP command, but if cheat engine is modifying the assembly code doesn't that mean we could simply hack the exe?  I haven't looked into it but I think ramjet is more intune to the lower level programming languages so I thought I would mention it.

On this Howard, this is exactly what I'm doing with cheat engine and it's trainer 'maker' for want of a better term. I have isolated the assembly structs for gathering inputs within the exe itself and should be able to inject this into anywhere I want in the running process. What I am looking at is gathering inputs from Joystick devices rather than RAW inputs. This means that a simple script from glovepie that lots of people use everyday and in the rest of their cabinets should be able to just map the gun to joystick inputs.

This means the exe will just grab inputs and copy the values into the correct locations as if it came from the Raw input code...

It's a different way of doing it, and I'm learning not only the assembly it was written in, but having to reverse engineer how Elsemi wrote the original code (without all the nice commentary by any of it). Come to think of it, I should also be able to read the output data directly in the process and call a dll from in the lua code external to the ROM but within the Cheat Engine code.

Look this it a lot hypothetical and I don't have much experience hacking games... (not normally been something I do). But it's the route I'm trying too :)

Ramjet
« Last Edit: January 31, 2013, 04:52:15 am by RamjetR »
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

Howard_Casto

  • Idiot Police
  • Trade Count: (+1)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 16758
  • Your Post's Soul is MINE!!! .......Again??
    • The Dragon King
Re: Sega Model 2 Emulator Full Screen Shooter fix - RamjetM2Borderless - App
« Reply #164 on: January 31, 2013, 06:54:55 am »
Well I can save you the trouble on the lua route..... I thought of that one and tried to overwrite the functions that way, it didn't seem to have any effect.  I don't think lua can see the static parts of the code, in other words the exe loaded into memory. 

I've actually got a few of hte functions isolated in cheat engine myself, but the CE addresses look like gibberish to me.  I'm going to try to get them via art money so I can get the address relative to m2 so I can access it from within model 2's lua.  That should make things much easier as it can just print me an address to use with the troubleshooter. 

Howard_Casto

  • Idiot Police
  • Trade Count: (+1)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 16758
  • Your Post's Soul is MINE!!! .......Again??
    • The Dragon King
Re: Sega Model 2 Emulator Full Screen Shooter fix - RamjetM2Borderless - App
« Reply #165 on: January 31, 2013, 07:31:56 am »
Good News! 

Instead of trying to follow the stupid pointers and baseaddresses and run-arounds and what not I opened up the exe in a hex editor and simply hacked the exe.  It disabled the Y-Value just fine.  So that problem at least is solved.  I have frozen these values in gunblade with nop's and my app can inject the values just fine after they are disabled.   

Memory hacking I'm not so great at, but file hacking I'm a little bit better at.  This just seems like an easier solution to me.  We can either supply hacked exes or I can make a patch at runtime. 

When you have time I'd appreciate it if you sent me any NOP-able addresses you've found thus far.... it'll just save me the trouble. 

Howard_Casto

  • Idiot Police
  • Trade Count: (+1)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 16758
  • Your Post's Soul is MINE!!! .......Again??
    • The Dragon King
Re: Sega Model 2 Emulator Full Screen Shooter fix - RamjetM2Borderless - App
« Reply #166 on: January 31, 2013, 05:37:12 pm »
Ok progress report. 

Spent all of 20 minutes this evening with the cheat engine to determine the lines of assembly code I need to NOP.  I've found all the code for the analog gun games.  I ran the troubleshooter 2 with the code disabled and my app no longer fights with m2, allowing my interface methods to work. 

Unfortunately the code to change the lightgun game values is in another location.  This actually makes sense because while the analog gun games use a single byte to store position (0-255) the lightgun games use two bytes for double that resolution (0-512).  Now RamJet already figured one of these out a few posts back, I think it was the x-value of p1 and all of the locations are generally in the same area, so I should be able to get that when I work on things again tonight.  Then I can make a patch, allowing you to have special "gun" versions of the exes for lightgun use. 

I haen't looked into hacking the address of the gun triggers yet.  This is actually a big deal for the lightgun games.  The reload button is hardcoded to the mouse's button 2, so without trigger hacking you wouldn't be able to reload! 

Anyway, more porgress as it comes in. 

vandale

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 318
  • Id 10 and t error
Re: Sega Model 2 Emulator Full Screen Shooter fix - RamjetM2Borderless - App
« Reply #167 on: February 01, 2013, 01:46:12 am »
looks promising, great work  :applaud:

Howard_Casto

  • Idiot Police
  • Trade Count: (+1)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 16758
  • Your Post's Soul is MINE!!! .......Again??
    • The Dragon King
Re: Sega Model 2 Emulator Full Screen Shooter fix - RamjetM2Borderless - App
« Reply #168 on: February 01, 2013, 02:12:25 am »
Ok more progress.....


I looked at the cheat engine file that ramjet sent me a while ago.  The good news is it DOES work universally, just for the lightgun games.  He's only gotten p1's addresses though so I'll poke around for player 2's addresses.  Looking at the assembly a little more I now know what to look for, so it's a bit easier for me to search for code generically. 


Ok on the analog gun front.... It turns out that I'll need to hack the exe in multiple places.  We've got three analog gun games right?  Gunblade, Rail Chase 2 and Behind Enemy Lines.  We'll I don't know if the hardware or software developers were sniffing glue or something, but even though all three games use the same hardware hookups and memory spaces, each one randomly inverts the values and/or port used. 

Gunblade NY:

The Y axis is inverted for both players

Rail Chase 2:

Both X and Y are inverted, player 1's gun is hooked up to player 2 and vice-versa

Behind Enemy Lines:

Mostly like Gunblade, but the calibration values are slightly different. 


So I'll have to patch the exe in multiple places.... not a huge deal, it just means a bit more work.  I haven't even looked into this yet aside from my initial hack because I want to get the rest of the lightgun data. 

In regards to triggers.... that is a bit of a tougher nut to crack.... doing a nop on the mouse buttons has become tedious to put it lightly.  Fortunately I was struck with a bit of common sense.  Elsemi hacked the lightgun functionality so that you couldn't move the cursor outside of the screen.  There is no reason that I need to do that.  I can allow the cursor to move outside the screen, just as it would in the arcades.  Not only does this solve my lack of a "reload button" problem, but it allows for original functionality.  In terms of a dedicated reload button, I can simply lock the gun position to outside of the screen and fire the game's trigger (I CAN do that at the game level) to simulate an outside screen shot whenver the user presses their reload button.  For dual mice-based lightguns of course I don't even have to do that, I can simply leave the original code as-is.... this is merely for joystick support. 

Anyway, I'm not sure if this is interesting to anyone... I'm just trying to keep everyone aprised of what I'm up to so we won't repeat each other's work. 

retrorepair

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 242
Re: Sega Model 2 Emulator Full Screen Shooter fix - RamjetM2Borderless - App
« Reply #169 on: February 01, 2013, 04:30:07 am »
Wow an awful lots been happening while I was away!

Firstly I hope everyone's ok what with the crazy weather of late.

As for the progress that's some mighty impressive stuff :)

If the exe can be patched at runtime I feel that might be a better approach unless you were willing to host the hacked exes but at this point I'll be happy with the darn thing just working :) Can this be done with output data too? It'd be great to do away with lua once and for all. I wonder if the exe can be patched for stereo sound again too..

BTW I would say Rail Chase had the x and y inverted due to the different controller on that game. I believe it was an actualy joystick rather than a large gun so it mechanically needed to be different. Not sure on behind enemy lines.

I'd be interested to know how you are hacking the exe using cheat engine btw, I understand memory locations (more than I used to anyway) but not sure how you can use that to find where to patch the exe.

Shaping up nicely!

RamjetR

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 144
    • My Youtube Channel
Re: Sega Model 2 Emulator Full Screen Shooter fix - RamjetM2Borderless - App
« Reply #170 on: February 01, 2013, 05:16:33 am »
Howard

The exe can have code injection enabled and disabled with a hotkey when needed. So it's quite easy to enable and disable all manner of code at will. It could probably even be triggered by the M2 LUA script on launch of the game.

The P1 code I sent you is from about 3 weeks ago (seemingly the last time I had a moment spare)... P2 data is a replica of that and can be found by scanning what access' the P2 XY 0x5xxxx addressing in games virtual RAM. Give me a couple days to gather this and make sure it's universally like P1. It requires me setting up a second mouse and configuring it and some monitoring... and some beer....

I haven't touched any actual code in the last week or so with the cyclone and floods. Working 18 hour days for 8 days in a row and I'm just looking forward to some game time this weekend.

On a side note, I found 20mins at work today to get kaillera to work. I'm oh so excited to get the guys into some 4 player TMNT/Sunset Riders/Simpsons. I was very impressed to see 4 players on a LAN playing the same MAME game without having to smell the guy beside me lol!

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

Howard_Casto

  • Idiot Police
  • Trade Count: (+1)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 16758
  • Your Post's Soul is MINE!!! .......Again??
    • The Dragon King
Re: Sega Model 2 Emulator Full Screen Shooter fix - RamjetM2Borderless - App
« Reply #171 on: February 01, 2013, 05:45:13 am »
***NOTE:  It seems like we all are posting at the same time anymore... RamJet's reply wasn't there when I started typing this****


Yeah it's currently 5 am here.  I had to go out at 3am and unplug my trickle charger for my car because I woke up in the middle of the night and it was snowing sideways!  Even though the thing is under a carport it was under a few inches of snow.  Which wouldn't be all that abnormal in terms of weather for my area this time of year if it hadn't have been 75 degrees (F) only two days ago.


I can patch it at runtime, but it doesn't make a lot of sense to do so.  It would have to copy the original exe and make a new one each time the game is launched.  So why not just copy the original exe, patch it, and leave it on the users computer permenantly?  The idea was the m2 portion of the troubleshooter would come with a setup program... it would generate new exes from your original ones as well as setup a few m2-oriented do-dads not required for other games and emulators. 

Lua isn't going away completely, it just won't actually do anything anymore.  The LUA scripts I am currently using do only two things.  They launch the troubleshooter (more of a matter of convienance than anything else) and they generate a csv file upon startup containing any dynamic addresses I might need.  After that the whole thing becomes dormant.  If somebody more versed in memory hacking can give me some sample code of how to get the dynamic addresses or is willing to go through the painstaking process of finding the re-direct pointers in m2 we can eliminate lua completely. 

Outputs are detected by the troubleshooter and passed along to mamehooker.  I don't mention that part a lot because it's basically done.  It works perfectly and the ts will be used for nearly all of the games in m2 because of it.  I've got the basic output data from most of them.  The only thing that eludes me are the outputs in desert tank, daytona and the vs billboard system for the fighting games. I'm talking about official outputs of course, we can easily (and I already have) use the memory locations that you and ramjet found for daytona as well.  My only request is that any output that isn't official have the flag "fake_"  tacked on to it for use in mamehooker.  I'm all about the documentation afterall. 

In regards to the cheat engine, there is a function called "find out what writes to this address" where it literally searches the assembly code of the running exe to see if there are any lines of code that make reference to the memory location you've currently selected.  There is also a "go to this section in assembly" option where you can see the actual code both in readable form and in raw hex.

So basically you

1.  Find the location in memory where the x/y/whatever position is stored

2.  Run the find out what writes to this value function on that position.

3.  Look at the hex of the code in question and write it down. 

4.  Open the exe in a hex editor, search for the hex code from #3, and replace it all with 0x90's (do nothings or NOPs). 

Howard_Casto

  • Idiot Police
  • Trade Count: (+1)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 16758
  • Your Post's Soul is MINE!!! .......Again??
    • The Dragon King
Re: Sega Model 2 Emulator Full Screen Shooter fix - RamjetM2Borderless - App
« Reply #172 on: February 01, 2013, 05:55:19 am »
Howard

The exe can have code injection enabled and disabled with a hotkey when needed. So it's quite easy to enable and disable all manner of code at will. It could probably even be triggered by the M2 LUA script on launch of the game.

The P1 code I sent you is from about 3 weeks ago (seemingly the last time I had a moment spare)... P2 data is a replica of that and can be found by scanning what access' the P2 XY 0x5xxxx addressing in games virtual RAM. Give me a couple days to gather this and make sure it's universally like P1. It requires me setting up a second mouse and configuring it and some monitoring... and some beer....

I haven't touched any actual code in the last week or so with the cyclone and floods. Working 18 hour days for 8 days in a row and I'm just looking forward to some game time this weekend.

On a side note, I found 20mins at work today to get kaillera to work. I'm oh so excited to get the guys into some 4 player TMNT/Sunset Riders/Simpsons. I was very impressed to see 4 players on a LAN playing the same MAME game without having to smell the guy beside me lol!

That's actually one of the reasons why I don't like trainers ramjet... hotkeys and mame cabs don't mix.  ;)  As I stated in this last reply, the way I was going to go about it was to just have different exes.  It's simple enough to just have the user launch the original exe if they ever want to retain original functionality.  Why they'd want to do that though is beyond me considering I'll be supporting dual mice in my app as well. 

I need to find the memory locations of the drawn on cursors as well.  People with IR guns might like some crosshairs on the lightgun games.

Kaillera is fun... used to do that with mame back in college... damn I'm getting old. 

BadMouth

  • Trade Count: (+6)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 8415
  • ...
Re: Sega Model 2 Emulator Full Screen Shooter fix - RamjetM2Borderless - App
« Reply #173 on: February 01, 2013, 11:22:40 am »
Anyway, I'm not sure if this is interesting to anyone... I'm just trying to keep everyone aprised of what I'm up to so we won't repeat each other's work.

Progress is being made.  It's interesting to everyone with two guns!

Wade007

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 309
  • A MAME cabinet at home is heaven
    • bit.ly/1cWnoIC
    • Cheapskategamer.com
Re: Sega Model 2 Emulator Full Screen Shooter fix - RamjetM2Borderless - App
« Reply #174 on: February 01, 2013, 11:41:07 am »
Anyway, I'm not sure if this is interesting to anyone... I'm just trying to keep everyone aprised of what I'm up to so we won't repeat each other's work.

I agree with BadMouth. +1 here who is VERY interested in the progress made here on this thread. I'd LOVE to see two lightguns working. Thanks for your hard work. Keep it up. I'll be watching from the sidelines.  :applaud:

http://www.cheapskategamer.com/pc_game_stories_and_news/true-light-gun-support-for-pc-gaming-the-arcade-guns%E2%84%A2-product-review/


« Last Edit: February 01, 2013, 11:42:50 am by Wade007 »
My Super Arcade cabinet project:
Software blog article: http://bit.ly/1cWnoIC

Hardware blog article: http://bit.ly/1dWxjvP

YouTube video: http://bit.ly/1N818Xm

Super Arcade Cabinet Progress thread (Now Complete):
http://forum.arcadecontrols.com/index.php/topic,123292.0.html

Frontend Video Intro: http://bit.ly/1P9HPDN

Howard_Casto

  • Idiot Police
  • Trade Count: (+1)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 16758
  • Your Post's Soul is MINE!!! .......Again??
    • The Dragon King
Re: Sega Model 2 Emulator Full Screen Shooter fix - RamjetM2Borderless - App
« Reply #175 on: February 02, 2013, 09:52:21 pm »
Ok, did some memory snooping tonight.  I couldn't find the real outputs for desert tank as apparently they are borked (confirmed this in mame) but I did find a dynamic value that stores the current view, similar to what ramjet found in daytona.  So I made a file for that. 

I dunno about the motor data, I think because all the limit switches and what not are improperly hooked up it isn't going to work right. 

One step at a time I guess. 

Howard_Casto

  • Idiot Police
  • Trade Count: (+1)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 16758
  • Your Post's Soul is MINE!!! .......Again??
    • The Dragon King
Re: Sega Model 2 Emulator Full Screen Shooter fix - RamjetM2Borderless - App
« Reply #176 on: February 02, 2013, 11:02:13 pm »
Fantastic news!

I finally figured out how to read dynamic addresses from an art money table programatically. 

Because artmoney isn't exactly clear about it I thought it would document it here. 

On the user/searching side:


1.  When searching in artmoney make sure you select the model 2 emulator from the emulator group so that it'll get you the relative addresses.

2.  After you've found what you are looking for, copy one of the values and change the address to 50,000 which is the start of RAM in m2... this give us a reference point.

3.  Subtract the 50,000 from all the addresses you found, this will give you a relative offset and THIS is the value that the troubleshooter needs. 


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. 



Anyway, this means that we no longer have to rely on the lua scripting to print out relative values, I can do it internally.  Unfortuantely that means I have to re-write a few sections of code, so the release might take a bit longer.  At least now I can do things the right way, including inserting NOP's into the running exe. 


Howard_Casto

  • Idiot Police
  • Trade Count: (+1)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 16758
  • Your Post's Soul is MINE!!! .......Again??
    • The Dragon King
Re: Sega Model 2 Emulator Full Screen Shooter fix - RamjetM2Borderless - App
« Reply #177 on: February 03, 2013, 01:16:32 am »
*update*

Actually this wasn't nearly as hard to implement as I initially thought.  I've already modified the output functions, I'll add code for the input functions and NOPs later. 

vandale

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 318
  • Id 10 and t error
Re: Sega Model 2 Emulator Full Screen Shooter fix - RamjetM2Borderless - App
« Reply #178 on: February 03, 2013, 02:49:35 am »
Hi, good progress, I check this thread daily.

Just out of interest, will all this hard work benefit all types of guns used on M2, ie Aimtracks, wiimotes and the old school CRT based light guns? I think most have IR aimtracks these days, and then theres the minorty like me who have wiimotes.

Thanks

Howard_Casto

  • Idiot Police
  • Trade Count: (+1)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 16758
  • Your Post's Soul is MINE!!! .......Again??
    • The Dragon King
Re: Sega Model 2 Emulator Full Screen Shooter fix - RamjetM2Borderless - App
« Reply #179 on: February 03, 2013, 03:29:52 am »
I'm supporting mice, lightguns and joysticks, so unless you want to play with the keyboard (why? dear god why?)  It should cover everything. 

Endprodukt

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 619
  • I want to build my own arcade controls!
Re: Sega Model 2 Emulator Full Screen Shooter fix - RamjetM2Borderless - App
« Reply #180 on: February 03, 2013, 08:23:24 am »
Awesome news! You're the man! :D

Howard_Casto

  • Idiot Police
  • Trade Count: (+1)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 16758
  • Your Post's Soul is MINE!!! .......Again??
    • The Dragon King
Re: Sega Model 2 Emulator Full Screen Shooter fix - RamjetM2Borderless - App
« Reply #181 on: February 03, 2013, 06:14:20 pm »
Thanks for the support guys. 

Ok, I implemented the NOP functions.  Gunblade is 100% playable with joysticks now.  At least for the multicpu version, I'll have to find the addresses for the other exe, but that doesn't take long.  I'm assuming that I can get rail chase to work 100% as well. 

But.... it seems like every time that I do a major leap forward with this thing, I find another annoying setback.  NOPs work just fine for the x/y axis on any of the games.... this is probably because the mice values have to be translated to the game values first, and I'm adjusting the game values.  When I try to NOP the triggers...  well it crashes.  This won't effect the analog gun games, you can remap the triggers (for joysticks) in m2 and it doesn't effect mice/trackballs/lightguns at all because you can use the mice buttons as-is.  BUT for people using joysticks on the lightgun games (which includes wiimotes) they won't have an easy way to reload. 

I'm sure it's something I can fix, but it's annoying to have to deal with this stuff every step of the way. 

Howard_Casto

  • Idiot Police
  • Trade Count: (+1)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 16758
  • Your Post's Soul is MINE!!! .......Again??
    • The Dragon King
Re: Sega Model 2 Emulator Full Screen Shooter fix - RamjetM2Borderless - App
« Reply #182 on: February 03, 2013, 07:40:25 pm »
Ok still making progress. 

Rail Chase 2 is now working 100%  again just for multicpus

Instead of using artmoney or the CE, I just looked for any bytes via a hex editor holding the memory address to NOP and sure enough, rail chase, although allocated in a different area, uses the same one.  It actually makes searching a bit easier.... if you find what you want in the actual exe file, you can add 0xC00 to it and that's the offest when in memory. 

So what's left is HOTD, VCOP, VCOP2 and BEL..... I think BEL and HOTD use the same interface and the two virtual cops use the same interface, so it's really only two games to find. 

Then I'll tackle that trigger issue. 

vandale

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 318
  • Id 10 and t error
Re: Sega Model 2 Emulator Full Screen Shooter fix - RamjetM2Borderless - App
« Reply #183 on: February 03, 2013, 07:57:03 pm »
woop woop

Howard_Casto

  • Idiot Police
  • Trade Count: (+1)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 16758
  • Your Post's Soul is MINE!!! .......Again??
    • The Dragon King
Re: Sega Model 2 Emulator Full Screen Shooter fix - RamjetM2Borderless - App
« Reply #184 on: February 04, 2013, 01:25:04 am »
A little bit of bad news.  I looked at the CE table that RamJet sent me for VCop and unless I am missing something the code in it doesn't work.  It does indeed freeze the values, but it does so persistantly.  In other words m2 constantly re-writes the last address.  So I'm going to have to look elsewhere unfortunately. 


Howard_Casto

  • Idiot Police
  • Trade Count: (+1)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 16758
  • Your Post's Soul is MINE!!! .......Again??
    • The Dragon King
Re: Sega Model 2 Emulator Full Screen Shooter fix - RamjetM2Borderless - App
« Reply #185 on: February 04, 2013, 02:52:23 am »
More strangeness... BEL is actually a analog gun game... it uses the same inputs as rail chase BUT there is some wierdness going on with it. 

First off you can't remap the triggers.... for whatever reason they have been hardcoded to the mouse like the true lightgun games.  Also the NOPs I have for p2Y don't work even though the other three NOPs (taken from rail chase) do.  I think it's because bel is kind of cludged in there and he's written special code for it.  I'll have to find the stupid thing. 

Also the outputs appear to be in a different location as well.... this is extremely odd as all the gun games have used the same address thus far. 

Howard_Casto

  • Idiot Police
  • Trade Count: (+1)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 16758
  • Your Post's Soul is MINE!!! .......Again??
    • The Dragon King
Re: Sega Model 2 Emulator Full Screen Shooter fix - RamjetM2Borderless - App
« Reply #186 on: February 04, 2013, 04:19:42 am »
Found something fun.  The Rail Chase 2 data for the motion cabinet is just a few bytes over from where you would normally find the lamp outputs!  I initially thought it was just some random data because in RC2's test menu the data goes nuts.  It turns out this is due to a cludge in the code to get the driver board working.  In the game it becomes apparent that this is the byte for motion data. 

Unfortuantely because the test mode is borked, I can't fully figure out the bitmasking to split it out into individual outputs.  I Know that 7 is the mask for the rear piston but that's about as far as I got. 

Endprodukt

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 619
  • I want to build my own arcade controls!
AW: Sega Model 2 Emulator Full Screen Shooter fix - RamjetM2Borderless - App
« Reply #187 on: February 04, 2013, 04:45:56 am »
Just for my interest: is it easier to implement the code for the analog or the light gun controls? Just wondering because your focus seems to be on analog games.

Howard_Casto

  • Idiot Police
  • Trade Count: (+1)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 16758
  • Your Post's Soul is MINE!!! .......Again??
    • The Dragon King
Re: Sega Model 2 Emulator Full Screen Shooter fix - RamjetM2Borderless - App
« Reply #188 on: February 04, 2013, 05:12:05 am »
The controls (my end) are equally easy to implement.  I use a joystick for my testing because it's a lot eaiser to test with than a lightgun. 

In terms of the games themselves, the analog gun games are the first I've found the memory addresses to, it's as simple as that. 

Endprodukt

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 619
  • I want to build my own arcade controls!
AW: Sega Model 2 Emulator Full Screen Shooter fix - RamjetM2Borderless - App
« Reply #189 on: February 04, 2013, 05:37:23 am »
Ah okay, thanks for explaining. Wish I would understand more on the technical side of things. Wondering how to find the right numbers in the hex code?

Howard_Casto

  • Idiot Police
  • Trade Count: (+1)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 16758
  • Your Post's Soul is MINE!!! .......Again??
    • The Dragon King
Re: Sega Model 2 Emulator Full Screen Shooter fix - RamjetM2Borderless - App
« Reply #190 on: February 04, 2013, 05:54:38 am »
Good news.  I figured out what was going on with the lightgun games.  There are actually a couple of addresses for each value that need to be NOPed, unlike the analog gun games where only one is necessary.  Not a huge deal to fix, I'll just have to do some more memory searching.  I can probably get bel fixed using this method as well. 

Trnzaddict

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 93
Re: Sega Model 2 Emulator Full Screen Shooter fix - RamjetM2Borderless - App
« Reply #191 on: February 04, 2013, 01:36:15 pm »
I check this thread a couple times a day.

 I so appreciate you trying to get dual mice to work in Model 2.

It's crazy though to have to go through all this hacking . If the source for model 2 was made freely available by El Semi this issue with having 2 mice work could of been alot easier to accomplish.

If I was an emu author, I would freely make my works source code available so the day I throw in the towel fans could improve/work on it. But to each their own.

Howard_Casto

  • Idiot Police
  • Trade Count: (+1)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 16758
  • Your Post's Soul is MINE!!! .......Again??
    • The Dragon King
Re: Sega Model 2 Emulator Full Screen Shooter fix - RamjetM2Borderless - App
« Reply #192 on: February 04, 2013, 08:30:10 pm »
Well the rumor is he got a job with SEGA, so I can certainly understand why he can't release the code now. 


Anyway, with the breakthrough last night in regards to the lightgun games, I managed to get p1's axis for all the lightguns to repond.  I'll search for p2's junk later. 

So all that remains for the m2 stuff are those pesky triggers.... I've really hit a stumbling block with those... any code I try either freezes the game or crashes it. 

RamjetR

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 144
    • My Youtube Channel
Re: Sega Model 2 Emulator Full Screen Shooter fix - RamjetM2Borderless - App
« Reply #193 on: February 05, 2013, 04:32:53 am »
Hi Howard,

I've been working on the triggers (along with the axis) and found the dynamic location where the multicpu is grabbing the mouse inputs and converting them ready to be written into the emulation. I haven't posted anything on it yet as I really haven't nailed down the assembly source variables as it calls a few subroutines whilst doing it (looks like it does a compare to the last reading and does a relative movement within the exe?). My idea was to grab the source bytes of data right before it's sent to the emulation and thus requiring only a single area to be modified rather than RAM injection and NOP'ing all the other hook code points (for which there appears quite a few).

I have printed out the assembly structure and currently mapping the stack and registries as it steps through the code to nail the actual variable it assigns dynamically. Like I say it's dynamic which points quite clearly that it's happening outside of the emulation space but within the M2 exe.

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

Howard_Casto

  • Idiot Police
  • Trade Count: (+1)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 16758
  • Your Post's Soul is MINE!!! .......Again??
    • The Dragon King
Re: Sega Model 2 Emulator Full Screen Shooter fix - RamjetM2Borderless - App
« Reply #194 on: February 05, 2013, 06:20:38 am »
Yeah if we are talking about the same thing, what it's actually doing is calling a dll.  The problem there is the dll crashes the program.  We might be able to get it that way but I dunno.  It would probably involve NOPing where the dll is called to begin with and then you'd have to NOP any instance of a function that accesses the dll.  But keep at it man.  The NOP functions I added to the app allow for infinate NOPs and they support pointers and offsets as well.  It's one of those things to whre if we find a better solution later on, all we need to do is edit the ini file for the game. 

I've got the axis working for every game now except p2 y axis for bel and p2 x axis for vcop2.  Pretty sure these games just do a special case and I need to find some redundant code to NOP.  The games are actually playable at this point... you just can't reload.  ;)  It would be nice to find the code for the cursors.  I can probably draw our own, but it'd be a pain in the butt.

It's starting the grate on me a little... been working on this too long.  At the same time I would feel defeated if a solution isn't found at this point, so I HAVE to finish. 

BadMouth

  • Trade Count: (+6)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 8415
  • ...
Re: Sega Model 2 Emulator Full Screen Shooter fix - RamjetM2Borderless - App
« Reply #195 on: February 05, 2013, 09:09:09 am »
I had some ideas and did 10 minutes of hurried testing before leaving for work this morning.

The trigger and reload buttons on the Act Labs guns work correctly for both players if raw input is enabled and their device #s are set correctly.
(all the bullets just go to the lower right corner because I'm testing with the plain m2emulator)
I imagine Aim-Traks would work this way also.  I will test this evening with the single one I have.

So if your troubleshooter program can function with raw input enabled, the trigger and reload buttons on the Act Labs and Aim-Traks would work fine without being interfered with by troubleshooter.

That leaves joystick input (and by extension, wii controllers).
I know if rawinput mode is not enabled, autohotkey can post fake mouse button presses for P1 and it works fine.
I don't know if it still works while in raw input mode.  I doubt Autohotkey can fake more than one mouse anyway, but maybe something else can trigger P2 reload.
I'll play around with reload this evening and try to find something useful.
Who knows, maybe El Semi left something in there for the old Act Labs guns that report mouse buttons 3 and 4 for player 2.
« Last Edit: February 05, 2013, 09:10:43 am by BadMouth »

Howard_Casto

  • Idiot Police
  • Trade Count: (+1)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 16758
  • Your Post's Soul is MINE!!! .......Again??
    • The Dragon King
Re: Sega Model 2 Emulator Full Screen Shooter fix - RamjetM2Borderless - App
« Reply #196 on: February 05, 2013, 05:38:07 pm »
I'll tell you what I need, but we would have to find somebody with one of the real lightgun games. 

In the gun mark check screen I need somebody to do an offscreen reload and see what the gun position comes up as.  I'm fairly confident that I can hack the inputs at the game level, but I checked the HOTD arcade manual and there isn't an input for reload, meaning that something else, like a specific gun value or something is telling the game to reload.  If the values don't change, then that means that the actual sensor inputis doing something (like maybe never giving a response) which causes the guns to reload. 

I honestly think trying to do things at the mouse level is going to open up a whole new can of worms.  Any functions or dlls that use rawinput crash like crazy whenever you try to halt them.... I think this is the crashing I get when I try to alter the mouse inputs. 

Howard_Casto

  • Idiot Police
  • Trade Count: (+1)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 16758
  • Your Post's Soul is MINE!!! .......Again??
    • The Dragon King
Re: Sega Model 2 Emulator Full Screen Shooter fix - RamjetM2Borderless - App
« Reply #197 on: February 05, 2013, 06:06:45 pm »
Well I actually found the reload address for p1 on vcop.  I had actually had it in there for a while, but I didn't understand what was going on. 

It's a simple integer value... 0 when off, 1 when on.  What threw me is in the assembly code, instead of just setting the value to 0 or 1, a byte is allocated or either 0 or 1 and then copied to the address space when the reload data is stored.  So instead of NOPing the functions that write these bytes (which crashes or freezes the emulator) I can simply NOP the two functions that copy the bytes to the area of code that actually does something with them.    Now that I understand what is going on, I should be able to get the trigger as well.  Regardless, if I map the trigger to joystick b#1 and the new reload bit to joystick b#2 I can reload when I press both buttons at the same time.  So it's a start anyway.

I'm off to check if it works in the other lightgun games as well. 

RamjetR

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 144
    • My Youtube Channel
Re: Sega Model 2 Emulator Full Screen Shooter fix - RamjetM2Borderless - App
« Reply #198 on: February 05, 2013, 06:53:03 pm »
Actually the reload still has it's off screen functionality, have you tried reloading with the fullscreen app running? Take a look at/for a memory address which toggles 1 - 17 with mouse left and Right clicked for Player 1

It binary equates to 00010001<- P1 Fire
                                       ^
                                        P1 Reload

This also becomes    00100010 when P2 Fire's and reloads

There are 5 entries of this with some lag between them. The primary state change looks like the initial read where the rest look like some bit wise operations are being added to provide a singe byte to send into the emulator.

They are happening up in the 900000 range with no 50000 RAM equivalent which suggests to me it's a EMU IO read which is sent direct to the virtual CPU.

So, to find this... fire up CE or ART... load the game and open process as per normal.

Do a first search for "1" , single byte... now before you click search... tab the "cursor" highlight the search button (in order to hit space bar to activate) and Press and hold the left mouse button somewhere on the CE or ART program. Hit search and you'll find all addresses with a 1 in it.

Then Filter or continue the search but this time look for "17" decimal, single byte and like before tab to the next search or filter search ready for the spacebar to look. Click and HOLD the right mouse button for the entire duration of the search.

This should reduce the results significantly... now, scan the list of results and look for a 0 after releasing the Right Click.... once you've found them, left click and right click away to see it toggle.... They are the ones you want. ART money for me on my work laptop has a repeatable location for this, but I'm at home today so I'll send that to you tomorrow (getting a TV picked up for return... faulty backlight).

Now because RAW input will capture both mouse cursors to the game screen, it's harder to do this search in that mode... go single player and it will be much easier. This Trigger capture does respond to the mouse outside of the game window, and again suggests to me it's not in game but the EXE capturing the mouse inputs. These same locations also apply to P2.

I'm getting pretty deep into the assembly code and although not directly helpful to your troubleshooter Howard, it's atleast applicable to enabling it's functionality. :)

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

RamjetR

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 144
    • My Youtube Channel
Re: Sega Model 2 Emulator Full Screen Shooter fix - RamjetM2Borderless - App
« Reply #199 on: February 05, 2013, 07:02:25 pm »
Bloomin heck, we're all posting at the same time hahaha

The offscreen reloading that appears to be happening in Elsemi's code looks to me to search for a trigger value and then checks the X-Y coordinates. If I'm reading it right, it looks like it puts a threshold window around the game and if it see's the a trigger at the edges then does the reload.

What I've found useful is to do a break and trace in CE to step through the code as it's executed with the registers intact... that was I can see if a compare/test comparision passed or failed and where it would then jump to in the code. You end up with pages of opcodes being executed and it's time consuming as you know.

***edit***

There doesn't appear to be an actual reload input to look for. As I mentioned above. The reload function looks like a state hack Elsemi did to create a Reload button because mice could not shoot off screen. The Trigger inputs toggle just fine as a 0/1 like you say where I go to service mode and check the input trigger. Toggles just fine, but there isn't a reload button. To find that, it's actually in a different location as "17" decimal (see post above this one)

With CE and ART, I can see all 9 or so memory locations toggle 0/1 with a Left click... but 4 of them will toggle to 17 on a right click where the rest continue to toggle 0/1 with a right click.
« Last Edit: February 05, 2013, 07:19:09 pm by RamjetR »
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

Howard_Casto

  • Idiot Police
  • Trade Count: (+1)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 16758
  • Your Post's Soul is MINE!!! .......Again??
    • The Dragon King
Re: Sega Model 2 Emulator Full Screen Shooter fix - RamjetM2Borderless - App
« Reply #200 on: February 05, 2013, 07:25:12 pm »
Ok gotcha. 

Those values up in the 90000's are the ones I always find and can't seem to do anything with.  As you know without extreme back-tracking they simply freeze or crash the emu if you try to NOP them. 

What I'm using, that apparently only works in vcop, is a buffer allocated at emulator.exe+18f7bc 

This appears to be about mid-way through all the mouse mess.  This buffer gets either a 0 or a +1 (for p1 reload) +2 (for p2 reload) copied to it after reading the mouse buttons.  This buffer is then passed along to the actual running game. 

At +b6614 there is an opcode to copy the 00
At +b6620 there is an opcode to copy the 01

The 02 is down in that area as well, I just haven't mapped it out yet. 

Now setting this bit to 1 is useless...doesn't do anything, you have to set it to 1 AND fire the trigger.  Again, just works for vcop, but I don't see why a special case would be made for that game, so similar code should be in there for the other games.  My guess is this is the value that sets the light sensor.  There are other values written to addresses in this area as well in a similar manner, so that's probably the trigger and misc buttons like start ect...

RamjetR

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 144
    • My Youtube Channel
Re: Sega Model 2 Emulator Full Screen Shooter fix - RamjetM2Borderless - App
« Reply #201 on: February 05, 2013, 07:52:13 pm »
lol, sending offsets is starting to get tricky... I'll look into it..

Here is a ART of the locations I'm talking about... to find a repeatable one which will come up in a relaunch of the file I had to set it to search the emulator space. This looks like the reload and fire conditions your looking for...

Use these to find what writes to these locations and you'll find the higher level code for writing to them.

Let me know what ya think.

Ramjet


.... are you using emulator.exe or multi? just so we're dealing with the same exe?
« Last Edit: February 05, 2013, 08:24:02 pm by RamjetR »
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

RamjetR

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 144
    • My Youtube Channel
Re: Sega Model 2 Emulator Full Screen Shooter fix - RamjetM2Borderless - App
« Reply #202 on: February 05, 2013, 11:18:24 pm »
Further playing around has shown something interesting up also...  Both player inputs are still active on the keyboard. My config is Player 1 buttons 1-4 = z,x,c,v and Player 1 UP,DOWN,LEFT,RIGHT are basic arrow keys.

Throw this line into your vcop.lua script on Post draw and watch the inputs...

function PostDraw()
Video_DrawText(20,10,HEX32(I960_ReadWord(RAMBASE+0x154D)),0xFFFFFF);
end

You'll get the display 00000000 which will toggle when the P1 and P2 fire and reload buttons are triggered. What I found interesting was this in hex;

P1 Fire      = 00000001
P1 Reload = 00000011

P2 Fire      = 00000002
P2 Reload = 00000022

When I press Z (P1 Button 1) and Down Arrow; and if I get the timing right, I can force a reload. It's sketchy but it works. Now the player will auto reload after a period of time, but many times I could reload with this combination long before that happened. Same with P2 keyboard equivalent for Button 1 + Down.

Player 1 Keyboard input
Z                        = 00000001
Z + Down Arrow = 00000011

Something about the attract screen mentioning to aim down and fire made me go looking for it. The good thing is it ties in with the mouse input code and the assembly structure I've been looking at. Responds just like both mice do. Latency in the wireless keyboard may have something to do with it? But it's worth looking at also injecting through the keyboard also.
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

RamjetR

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 144
    • My Youtube Channel
Re: Sega Model 2 Emulator Full Screen Shooter fix - RamjetM2Borderless - App
« Reply #203 on: February 06, 2013, 01:25:13 am »
I just had this thought.... I wonder if Elsemi glances past this thread once in a while and chuckles to himself, shaking his head and saying.... "Wrong....!" "Getting colder".... "Getting waaAAAARMer" .... "Nope".... "Oh c'mon, its right there!"....

It made me giggle to think...
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

Howard_Casto

  • Idiot Police
  • Trade Count: (+1)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 16758
  • Your Post's Soul is MINE!!! .......Again??
    • The Dragon King
Re: Sega Model 2 Emulator Full Screen Shooter fix - RamjetM2Borderless - App
« Reply #204 on: February 06, 2013, 01:38:45 am »
Well let's put it this way, the guy could send some data via an anonymous account. 

Yeah one of the problems with the rambase addresses is I can't figure out how to add them in the cheat engine, where we have that nice op-code browser. 

The op-code search feature doesn't work well uness you have the pointer, not the physical address. 

For the lightgun games I'm currently using emulator.exe....  I just started with that file you sent me, so it was easier.  Unless the 64bit version of the exe is drastically different, I can use a hex editor to search for the same opcodes, so it isn't going to be a big deal to find both once we get everything sorted out. 

I've actually got a lua address to that reload data I sent you, it's at 501698.  That's what I started with.  I think I actually used the getramptr in lua to print out the address, and added it to cheat money manually and then used THAT to find the offset. 

I'll look into the stuff you sent me..... I was aware of the keyboard stuff but I haven't seen if it's writeable yet..... One of the reasons I wanted to avoid it is if I NOPed the thing I'd probably have to manage all of the inputs....

RamjetR

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 144
    • My Youtube Channel
Re: Sega Model 2 Emulator Full Screen Shooter fix - RamjetM2Borderless - App
« Reply #205 on: February 06, 2013, 01:55:34 am »
I changed back to Multi because that what I thought you were working with. So that art file is for multi. Multi is different, I'm not sure how... but it is. Stuff I save from one file doesn't work on the other... :S

I've found if you just add the code to your code list, you can find your way back there pretty quickly. Have you done a referenced string search on the exe yet?

It maps out the code really nicely and seems to clump the code into it's called subroutines nicely. Better still, it's shows any referenced comments to the code usage such as GetRawData etc...

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

vandale

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 318
  • Id 10 and t error
Re: Sega Model 2 Emulator Full Screen Shooter fix - RamjetM2Borderless - App
« Reply #206 on: February 06, 2013, 02:30:58 am »
Hi guys, I have been following this thread really closely and looking forward to a solution :)

I do have a question, please dont flame me if it is considered stupid etc...

Currently in M2 we can play 2 player shooting games with 2 individual mice, all functions working ok, ie shoot, reload and cross hair control. XP, Vista and Windows 7 all tested with 2 mice ok.

Now this is where I lose the understanding of the finer detail.

My question is, why cant we just hijack those 2 mice inputs and map them to our guns, joysticks, wiimotes etc without having to do these memory hack etc? ie have a program that sits between windows mice and our guns.

Really looking for a detailed answer to improve my understanding.
Thanks

Howard_Casto

  • Idiot Police
  • Trade Count: (+1)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 16758
  • Your Post's Soul is MINE!!! .......Again??
    • The Dragon King
Re: Sega Model 2 Emulator Full Screen Shooter fix - RamjetM2Borderless - App
« Reply #207 on: February 06, 2013, 02:37:12 am »
Well it's not different, it just has some different code in it, for 64bit optimizations.  So all offsets are invalid. 

I'll look at the artmoney later, but I did look into the keyboard input.  It was a dead end as expected.   I can freeze the value via NOPing the first code found, but it makes it "all on" and I can't modify it.   What we need to find is the area where the actual bitwize additions are added.  (1, 17,ect....)   If you comment all of those out, you can modify the actual address at will because you've essentially made it passive.  That's why the original troubleshooter had you set the games in keyboard mode btw.  Since that is a passive buffer (the x/y pos are only added and subtracted to when a key is pressed) you don't have to fight the original code. 

Maybe a search for 17?  That's an odd enough value (not a power of 2).  Although it could be a 1 and then a 16 (1 for trigger and 16 for reload). 


By references string search what do you mean?  I'm still learning how to use the cheat engine /art money. 


Vandale:  I've said multiple times in this thread, you CANNOT fake raw mice in windows.  You can fake the system mouse, but that is not the same thing.  Since m2 is reading raw mouse, we don't get a choice, at least not for 2 player mode.  If you can find somebody to make a false mouse driver similar to vjoy then knock yourself out, but you need a real driver and/or hardware device to fake a mouse at the hardware level. 

Howard_Casto

  • Idiot Police
  • Trade Count: (+1)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 16758
  • Your Post's Soul is MINE!!! .......Again??
    • The Dragon King
Re: Sega Model 2 Emulator Full Screen Shooter fix - RamjetM2Borderless - App
« Reply #208 on: February 06, 2013, 02:50:14 am »
I know how programs are usually compiled, but you never know so I made sure and did a hex search for the values to change in the other exe.  They are in there and I can block them, so we are good.  I'm going to go ahead and make ini's for both exes to make things simplier. 


*update*

I went ahead and made the non-multicpu NOP entries for gunblade.  It was actually quite simple.  I first opened the multicpu.exe and my cheat engine file for the emulator and left it running.  I opened each code entry in ce that I nop to see the raw hex... I then searched for that hex via a hex editor in the vanilla emulator.exe.  ONce I found the right one (there are multiple calls) I added it to the troubleshooter ini and compared that offset to the offest for the multicpu version.  The offset change between the two are relative, which means I only have to find the first new NOP address and then do some math to adjust the other three.  It should be the same for all the others.  I'll go ahead and do this when I get a chance so that we don't have to play the "which exe" game.  I can give you data on both. 
« Last Edit: February 06, 2013, 03:14:58 am by Howard_Casto »

Howard_Casto

  • Idiot Police
  • Trade Count: (+1)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 16758
  • Your Post's Soul is MINE!!! .......Again??
    • The Dragon King
Re: Sega Model 2 Emulator Full Screen Shooter fix - RamjetM2Borderless - App
« Reply #209 on: February 06, 2013, 07:26:59 am »
Finally found the triggers! 

Well almost....

I found a way to freeze the keyboard inputs via the post ramjet did a few hours ago after remembering something odd about sega machines.  They invert the bytes usually. 

So instead of looking for a "1" when the trigger is pulled I need to look for a 254.  Sure enough I found it and via a few NOPs I managed to feeze the keyboard/joystick buffer. 

The down trick also works as you described... the reason it doesn't always work when you are doing it manually is the mouse code overrides it somewhat, so you have to block mouse input and send a 0xff- 0x101 (or 238).   Now the bad news is as I feared, it's blocking the coin and start inputs as well.  I'll have to keep working on it. 

Howard_Casto

  • Idiot Police
  • Trade Count: (+1)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 16758
  • Your Post's Soul is MINE!!! .......Again??
    • The Dragon King
Re: Sega Model 2 Emulator Full Screen Shooter fix - RamjetM2Borderless - App
« Reply #210 on: February 06, 2013, 08:02:31 am »
Well that did it.  And the good news is this code at least, is universal, so no more picking around for codes. 

I found the other byte for the start/coins.... it's in the same place for vcop2 and hotd as well as gunblade, but vcop 1 has to be special and moves it around by a byte.  Like the triggers and normal buttons, it's inverted, so 254 for coin 1, 252 for coin 2, ect...  That'll be a pain as I'll have to re-route the non-game inputs back into the emulator, but since the troubleshooter will support key re-direction for the pc games anyway, it isn't a huge deal. 

I'll go about coding this later this evening as I'll have to add special "inverted" bitmask options.  So aside from some problems on bel, I think all the relevant code has finally been found!

Endprodukt

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 619
  • I want to build my own arcade controls!
AW: Sega Model 2 Emulator Full Screen Shooter fix - RamjetM2Borderless - App
« Reply #211 on: February 06, 2013, 08:42:32 am »
Awesome news! Great work, can't wait :)

RamjetR

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 144
    • My Youtube Channel
Re: Sega Model 2 Emulator Full Screen Shooter fix - RamjetM2Borderless - App
« Reply #212 on: February 06, 2013, 06:07:03 pm »
I'll look at the artmoney later, but I did look into the keyboard input.  It was a dead end as expected.   I can freeze the value via NOPing the first code found, but it makes it "all on" and I can't modify it.   What we need to find is the area where the actual bitwize additions are added.  (1, 17,ect....)   If you comment all of those out, you can modify the actual address at will because you've essentially made it passive.  That's why the original troubleshooter had you set the games in keyboard mode btw.  Since that is a passive buffer (the x/y pos are only added and subtracted to when a key is pressed) you don't have to fight the original code. 

Maybe a search for 17?  That's an odd enough value (not a power of 2).  Although it could be a 1 and then a 16 (1 for trigger and 16 for reload). 


By references string search what do you mean?  I'm still learning how to use the cheat engine /art money. 

Referenced strings.

Open up Memory Viewer... CTRL+B

Then click View>Referenced String ( or CTRL+ALT+R) for Referenced String search. Hit Yes for disect code. Should come up with a referenced call list of procedures. Helpful for figuring out what goes where...

Definately take a look at it....

Great news on the keyboard side. Although it doesn't interfere with the game at all does it? should it need to be NOP'd? Or does it interfere with injecting the Fire and Reload input?

Things are looking good atleast :) Looks like we're gonna have to buy some light guns afterall howard :)
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

Howard_Casto

  • Idiot Police
  • Trade Count: (+1)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 16758
  • Your Post's Soul is MINE!!! .......Again??
    • The Dragon King
Re: Sega Model 2 Emulator Full Screen Shooter fix - RamjetM2Borderless - App
« Reply #213 on: February 06, 2013, 08:53:28 pm »
Well what I'm doing is NOPing all writes of the inputs buffers at the game end.  So keyboards and mice don't have any effect on the games at all, only the values that I inject into the buffers do.  I also have to NOP the mice buttons for obvious reasons. 

Since I posted that this morning, I have found a *little* variance, I think gunblade was giving me grief, but it works for the true lightgun games anyway and those are the ones you can't remap the buttons.  Bel is still screwed up... I can't get the new input buffers to work right on it either.  I'm honestly wondering how hacked up it's code is as everything seems to be a special case with it. 

I'd really like to find out where the crosshairs are being drawn.  I found the cursor positions, both in pixels and mickeys, but NOPing their relevant functions doesn't seem to do anything.  For the analog games they are irrelevant and I actually wonder why they were added, but they are sort of necessary for the lightgun games if you are using an ir gun.

Howard_Casto

  • Idiot Police
  • Trade Count: (+1)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 16758
  • Your Post's Soul is MINE!!! .......Again??
    • The Dragon King
Re: Sega Model 2 Emulator Full Screen Shooter fix - RamjetM2Borderless - App
« Reply #214 on: February 07, 2013, 01:56:29 am »
Well I added in code to read keyboard states.  Took way longer than it should have considering how many times I've done it over the years. 

I'll add in code to fake key states later.  That is required for the pc games. 


Then I'll have to write code to inject the start and coin keys into the game's input buffers for use with model 2. 

BadMouth

  • Trade Count: (+6)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 8415
  • ...
Re: Sega Model 2 Emulator Full Screen Shooter fix - RamjetM2Borderless - App
« Reply #215 on: February 07, 2013, 08:54:40 am »
Then I'll have to write code to inject the start and coin keys into the game's input buffers for use with model 2.

So are you pretty much doing away with mapping any of the controls in the M2 menus and having them all mapped in the troubleshooter program?

nipsmg

  • Trade Count: (+1)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 1331
  • ROONEY!! ERRGH!!
    • Arcadia
Re: Sega Model 2 Emulator Full Screen Shooter fix - RamjetM2Borderless - App
« Reply #216 on: February 07, 2013, 09:40:09 am »
Howard:

Thanks for the massive amount of time you're spending on this and you spend on the hobby in general.  I'm psyched about this, and can't wait to see how it turns out.


Howard_Casto

  • Idiot Police
  • Trade Count: (+1)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 16758
  • Your Post's Soul is MINE!!! .......Again??
    • The Dragon King
Re: Sega Model 2 Emulator Full Screen Shooter fix - RamjetM2Borderless - App
« Reply #217 on: February 07, 2013, 05:22:48 pm »
Then I'll have to write code to inject the start and coin keys into the game's input buffers for use with model 2.

So are you pretty much doing away with mapping any of the controls in the M2 menus and having them all mapped in the troubleshooter program?

Well not 100%.  They are in different byte sections.  The function I'm NOPing writes to two bytes, the game bytes and the service bytes.  So all the game buttons, start buttons, coin and service buttons.  Pause would still work as would any of the hardcoded keys.  Basically anything at the game level yes, but anything else no.  But each game in model2 will be treated as a stand-alone pc game with it's own configurations ect... so like on the analog gun games you wouldn't necessarily have to use the key injection. 


Thanks for the support guys. 

Howard_Casto

  • Idiot Police
  • Trade Count: (+1)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 16758
  • Your Post's Soul is MINE!!! .......Again??
    • The Dragon King
Re: Sega Model 2 Emulator Full Screen Shooter fix - RamjetM2Borderless - App
« Reply #218 on: February 08, 2013, 03:59:00 am »
Uggh.....You know I don't need this when I'm busy coding. 


I finished up the key detection/faking code and I thought I would test it on the one pc game I have that the original troubleshooter supported, House of the Dead 3.  Well the install is borked again, which is annoying considering I was using it for testing just last week.  Honestly it seems like I re-install the thing all the time. 

Just re-installed, it's not helping, so I dunno what is going on. 

Howard_Casto

  • Idiot Police
  • Trade Count: (+1)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 16758
  • Your Post's Soul is MINE!!! .......Again??
    • The Dragon King
Re: Sega Model 2 Emulator Full Screen Shooter fix - RamjetM2Borderless - App
« Reply #219 on: February 08, 2013, 04:21:39 am »
Well for whatever reason HOTD3 has decided to stop accepting my 360 gamepad, even though this is the exact same pad I used last week. 

I might have to download another game just to test things, which is extremely annoying. 

Howard_Casto

  • Idiot Police
  • Trade Count: (+1)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 16758
  • Your Post's Soul is MINE!!! .......Again??
    • The Dragon King
Re: Sega Model 2 Emulator Full Screen Shooter fix - RamjetM2Borderless - App
« Reply #220 on: February 08, 2013, 05:07:56 am »
Well my personal computer issues aside, I tested the key detection/faking via hotd3 and a gamecube controller hooked up to an adaptor of all things.  After a bit of tweaking I got it working just fine. 

I also enabled the "fake system mouse for p1" option and sure enough it worked just great when selecting a path from within the game.  There was one minor hiccup though that I found a work-around for.  You see, for whatever idiotic reason hotd3 presses the "start" button when you either fire or press the actual start button.  So in the main title screen, when you try to click the arrows to select a mode, the game goes up/down one mode as expected, but then immediately enters that mode!  The solution was easy enough.... I mapped the worthless coin 1 and coin 2 inputs for that game to the up and down keys in the game.  So to select a mode you can use your coin inputs.  Since the inputs on the user-end are reconfigurable, you could map these to your cabs joystick or to some extra buttons (perhaps a d-pad) on your lightgun.  So yeah, it's an improvment over the way the original troubleshooter did it imho since now yo don't have to walk back to your cab to select a route, you can just point and fire. 

Howard_Casto

  • Idiot Police
  • Trade Count: (+1)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 16758
  • Your Post's Soul is MINE!!! .......Again??
    • The Dragon King
Re: Sega Model 2 Emulator Full Screen Shooter fix - RamjetM2Borderless - App
« Reply #221 on: February 08, 2013, 06:07:58 am »
I went ahead and coded in support for inverted bitmasking that I mentioned yesterday. 

I could have added even more options in the already crowded ini, but I decided to just have developers use a negative number when they want to invert bits.  So -16 = "not 16"


I'll add in the code to allow for writing to start/coin/ect addresses tomorrow.  That's all for tonight. 

Howard_Casto

  • Idiot Police
  • Trade Count: (+1)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 16758
  • Your Post's Soul is MINE!!! .......Again??
    • The Dragon King