The NEW Build Your Own Arcade Controls

Main => Software Forum => Topic started by: RamjetR on July 11, 2012, 08:36:58 pm

Title: Sega Model 2 Emulator Full Screen Shooter fix - RamjetM2Borderless - App
Post by: RamjetR on July 11, 2012, 08:36:58 pm
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 (http://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 (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 (http://www.youtube.com/watch?v=m2uH_v4e7SE#)

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
Title: Re: Sega Model 2 Emulator Full Screen Shooter fix - RamjetM2Borderless - App
Post by: Wade007 on July 11, 2012, 10:55:43 pm
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!!
Title: Re: Sega Model 2 Emulator Full Screen Shooter fix - RamjetM2Borderless - App
Post by: Wade007 on July 18, 2012, 12:34:01 am
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/ (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 (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.
Title: Re: Sega Model 2 Emulator Full Screen Shooter fix - RamjetM2Borderless - App
Post by: Aceisback on August 26, 2012, 02:31:07 pm
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
Title: Re: Sega Model 2 Emulator Full Screen Shooter fix - RamjetM2Borderless - App
Post by: RamjetR 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
Title: Re: Sega Model 2 Emulator Full Screen Shooter fix - RamjetM2Borderless - App
Post by: mike boss 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.
Title: Re: Sega Model 2 Emulator Full Screen Shooter fix - RamjetM2Borderless - App
Post by: mike boss 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.
Title: Re: Sega Model 2 Emulator Full Screen Shooter fix - RamjetM2Borderless - App
Post by: RamjetR 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. :)
Title: Re: Sega Model 2 Emulator Full Screen Shooter fix - RamjetM2Borderless - App
Post by: nipsmg 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.
Title: Re: Sega Model 2 Emulator Full Screen Shooter fix - RamjetM2Borderless - App
Post by: Howard_Casto 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.
Title: Re: Sega Model 2 Emulator Full Screen Shooter fix - RamjetM2Borderless - App
Post by: mike boss 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.

Title: Re: Sega Model 2 Emulator Full Screen Shooter fix - RamjetM2Borderless - App
Post by: Howard_Casto 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.
Title: Re: Sega Model 2 Emulator Full Screen Shooter fix - RamjetM2Borderless - App
Post by: retrorepair 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.
Title: Re: Sega Model 2 Emulator Full Screen Shooter fix - RamjetM2Borderless - App
Post by: Howard_Casto 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.
Title: Re: Sega Model 2 Emulator Full Screen Shooter fix - RamjetM2Borderless - App
Post by: retrorepair 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.
Title: Re: Sega Model 2 Emulator Full Screen Shooter fix - RamjetM2Borderless - App
Post by: Howard_Casto 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. 
Title: Re: Sega Model 2 Emulator Full Screen Shooter fix - RamjetM2Borderless - App
Post by: retrorepair 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.
Title: Re: Sega Model 2 Emulator Full Screen Shooter fix - RamjetM2Borderless - App
Post by: Howard_Casto 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.
Title: Re: Sega Model 2 Emulator Full Screen Shooter fix - RamjetM2Borderless - App
Post by: RamjetR 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
Title: Re: Sega Model 2 Emulator Full Screen Shooter fix - RamjetM2Borderless - App
Post by: RamjetR 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
Title: Re: Sega Model 2 Emulator Full Screen Shooter fix - RamjetM2Borderless - App
Post by: Howard_Casto 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. 

Title: Re: Sega Model 2 Emulator Full Screen Shooter fix - RamjetM2Borderless - App
Post by: Howard_Casto 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.
Title: Re: Sega Model 2 Emulator Full Screen Shooter fix - RamjetM2Borderless - App
Post by: Howard_Casto 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.
Title: Re: Sega Model 2 Emulator Full Screen Shooter fix - RamjetM2Borderless - App
Post by: Howard_Casto 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. 
Title: Re: Sega Model 2 Emulator Full Screen Shooter fix - RamjetM2Borderless - App
Post by: BadMouth 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?
Title: Re: Sega Model 2 Emulator Full Screen Shooter fix - RamjetM2Borderless - App
Post by: Howard_Casto on September 08, 2012, 01:19:04 pm
Probably, but you'd have to explain a bit more what you are talking about.
Title: Re: Sega Model 2 Emulator Full Screen Shooter fix - RamjetM2Borderless - App
Post by: BadMouth 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.



Title: Re: Sega Model 2 Emulator Full Screen Shooter fix - RamjetM2Borderless - App
Post by: Howard_Casto 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.
Title: Re: Sega Model 2 Emulator Full Screen Shooter fix - RamjetM2Borderless - App
Post by: RamjetR 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.


Title: Re: Sega Model 2 Emulator Full Screen Shooter fix - RamjetM2Borderless - App
Post by: Howard_Casto 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.
Title: Re: Sega Model 2 Emulator Full Screen Shooter fix - RamjetM2Borderless - App
Post by: Howard_Casto 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. 
Title: Re: Sega Model 2 Emulator Full Screen Shooter fix - RamjetM2Borderless - App
Post by: RamjetR 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

Title: Re: Sega Model 2 Emulator Full Screen Shooter fix - RamjetM2Borderless - App
Post by: Howard_Casto 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.
Title: Re: Sega Model 2 Emulator Full Screen Shooter fix - RamjetM2Borderless - App
Post by: RamjetR 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
Title: Re: Sega Model 2 Emulator Full Screen Shooter fix - RamjetM2Borderless - App
Post by: Howard_Casto 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.
Title: Re: Sega Model 2 Emulator Full Screen Shooter fix - RamjetM2Borderless - App
Post by: theonegoku 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.
Title: Re: Sega Model 2 Emulator Full Screen Shooter fix - RamjetM2Borderless - App
Post by: Howard_Casto 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. 
Title: Re: Sega Model 2 Emulator Full Screen Shooter fix - RamjetM2Borderless - App
Post by: theonegoku 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 ;)
Title: Re: Sega Model 2 Emulator Full Screen Shooter fix - RamjetM2Borderless - App
Post by: Howard_Casto 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)
Title: Re: Sega Model 2 Emulator Full Screen Shooter fix - RamjetM2Borderless - App
Post by: Howard_Casto 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.
Title: Re: Sega Model 2 Emulator Full Screen Shooter fix - RamjetM2Borderless - App
Post by: RamjetR 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!

 
Title: Re: Sega Model 2 Emulator Full Screen Shooter fix - RamjetM2Borderless - App
Post by: Howard_Casto 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. 
Title: Re: Sega Model 2 Emulator Full Screen Shooter fix - RamjetM2Borderless - App
Post by: Howard_Casto 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.  ;)
Title: Re: Sega Model 2 Emulator Full Screen Shooter fix - RamjetM2Borderless - App
Post by: retrorepair 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.
Title: Re: Sega Model 2 Emulator Full Screen Shooter fix - RamjetM2Borderless - App
Post by: Howard_Casto 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.
Title: Re: Sega Model 2 Emulator Full Screen Shooter fix - RamjetM2Borderless - App
Post by: RamjetR 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
Title: Re: Sega Model 2 Emulator Full Screen Shooter fix - RamjetM2Borderless - App
Post by: retrorepair 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.
Title: Re: Sega Model 2 Emulator Full Screen Shooter fix - RamjetM2Borderless - App
Post by: RamjetR 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
Title: Re: Sega Model 2 Emulator Full Screen Shooter fix - RamjetM2Borderless - App
Post by: retrorepair 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 (http://www.mameworld.info/ubbthreads/showflat.php?Cat=&Number=297577&page=0&view=collapsed&sb=5&o=&fpart=1&vc=1&new=1356355038)

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.
Title: Re: Sega Model 2 Emulator Full Screen Shooter fix - RamjetM2Borderless - App
Post by: retrorepair 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).
Title: Re: Sega Model 2 Emulator Full Screen Shooter fix - RamjetM2Borderless - App
Post by: Howard_Casto 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. 
Title: Re: Sega Model 2 Emulator Full Screen Shooter fix - RamjetM2Borderless - App
Post by: RamjetR 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
Title: Re: Sega Model 2 Emulator Full Screen Shooter fix - RamjetM2Borderless - App
Post by: BadMouth 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 (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.
Title: Re: Sega Model 2 Emulator Full Screen Shooter fix - RamjetM2Borderless - App
Post by: Howard_Casto 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?
Title: Re: Sega Model 2 Emulator Full Screen Shooter fix - RamjetM2Borderless - App
Post by: vandale 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?
Title: Re: Sega Model 2 Emulator Full Screen Shooter fix - RamjetM2Borderless - App
Post by: Howard_Casto 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. 
Title: Re: Sega Model 2 Emulator Full Screen Shooter fix - RamjetM2Borderless - App
Post by: vandale 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
Title: Re: Sega Model 2 Emulator Full Screen Shooter fix - RamjetM2Borderless - App
Post by: vandale on January 14, 2013, 06:50:47 am
very poor quality video

http://tinyurl.com/a9w7vag (http://tinyurl.com/a9w7vag)

look for the small circle cross hairs
Title: Re: Sega Model 2 Emulator Full Screen Shooter fix - RamjetM2Borderless - App
Post by: Howard_Casto 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. 
Title: Re: Sega Model 2 Emulator Full Screen Shooter fix - RamjetM2Borderless - App
Post by: BadMouth 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.

Title: Re: Sega Model 2 Emulator Full Screen Shooter fix - RamjetM2Borderless - App
Post by: vandale 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
Title: Re: Sega Model 2 Emulator Full Screen Shooter fix - RamjetM2Borderless - App
Post by: vandale 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
Title: Re: Sega Model 2 Emulator Full Screen Shooter fix - RamjetM2Borderless - App
Post by: Howard_Casto 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. 
Title: Re: Sega Model 2 Emulator Full Screen Shooter fix - RamjetM2Borderless - App
Post by: vandale 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
Title: Re: Sega Model 2 Emulator Full Screen Shooter fix - RamjetM2Borderless - App
Post by: vandale on January 15, 2013, 10:39:49 pm
vid video 2013 01 14 21 02 53 (http://www.youtube.com/watch?v=7wKSovIZNGU#ws)
Title: Re: Sega Model 2 Emulator Full Screen Shooter fix - RamjetM2Borderless - App
Post by: BadMouth 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:
Title: Re: Sega Model 2 Emulator Full Screen Shooter fix - RamjetM2Borderless - App
Post by: BadMouth 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:

Title: Re: Sega Model 2 Emulator Full Screen Shooter fix - RamjetM2Borderless - App
Post by: vandale 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

Title: Re: Sega Model 2 Emulator Full Screen Shooter fix - RamjetM2Borderless - App
Post by: retrorepair 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?
Title: Re: Sega Model 2 Emulator Full Screen Shooter fix - RamjetM2Borderless - App
Post by: vandale 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
Title: Re: Sega Model 2 Emulator Full Screen Shooter fix - RamjetM2Borderless - App
Post by: Howard_Casto 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. 
Title: Re: Sega Model 2 Emulator Full Screen Shooter fix - RamjetM2Borderless - App
Post by: vandale 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
Title: Re: Sega Model 2 Emulator Full Screen Shooter fix - RamjetM2Borderless - App
Post by: retrorepair 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.
Title: Re: Sega Model 2 Emulator Full Screen Shooter fix - RamjetM2Borderless - App
Post by: BadMouth 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/ (http://www.autohotkey.com/board/topic/48827-ppjoy-library/)

On a side note, doesn't the Aim-Trak have a "joystick mode" ?
Title: Re: Sega Model 2 Emulator Full Screen Shooter fix - RamjetM2Borderless - App
Post by: Howard_Casto 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). 


Title: Re: Sega Model 2 Emulator Full Screen Shooter fix - RamjetM2Borderless - App
Post by: BadMouth 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.


Title: Re: Sega Model 2 Emulator Full Screen Shooter fix - RamjetM2Borderless - App
Post by: Howard_Casto 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. 
Title: Re: Sega Model 2 Emulator Full Screen Shooter fix - RamjetM2Borderless - App
Post by: vandale 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.

Title: Re: Sega Model 2 Emulator Full Screen Shooter fix - RamjetM2Borderless - App
Post by: Howard_Casto 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.   
Title: Re: Sega Model 2 Emulator Full Screen Shooter fix - RamjetM2Borderless - App
Post by: Howard_Casto 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. 
Title: Re: Sega Model 2 Emulator Full Screen Shooter fix - RamjetM2Borderless - App
Post by: BadMouth 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.  :)
Title: Re: Sega Model 2 Emulator Full Screen Shooter fix - RamjetM2Borderless - App
Post by: Howard_Casto 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. 
Title: Re: Sega Model 2 Emulator Full Screen Shooter fix - RamjetM2Borderless - App
Post by: Howard_Casto 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! 
Title: Re: Sega Model 2 Emulator Full Screen Shooter fix - RamjetM2Borderless - App
Post by: retrorepair 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?).
Title: Re: Sega Model 2 Emulator Full Screen Shooter fix - RamjetM2Borderless - App
Post by: Howard_Casto 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. 
Title: Re: Sega Model 2 Emulator Full Screen Shooter fix - RamjetM2Borderless - App
Post by: RamjetR 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... 
Title: Re: Sega Model 2 Emulator Full Screen Shooter fix - RamjetM2Borderless - App
Post by: Howard_Casto 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. 
Title: Re: Sega Model 2 Emulator Full Screen Shooter fix - RamjetM2Borderless - App
Post by: Howard_Casto on January 22, 2013, 12:00:20 am
Sometimes a picture is worth a thousand words:

http://img43.imageshack.us/img43/4200/outputsk.jpg (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. 
Title: Re: Sega Model 2 Emulator Full Screen Shooter fix - RamjetM2Borderless - App
Post by: retrorepair 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.
Title: Re: Sega Model 2 Emulator Full Screen Shooter fix - RamjetM2Borderless - App
Post by: Howard_Casto 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?
Title: Re: Sega Model 2 Emulator Full Screen Shooter fix - RamjetM2Borderless - App
Post by: Howard_Casto 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. 
Title: Re: Sega Model 2 Emulator Full Screen Shooter fix - RamjetM2Borderless - App
Post by: BadMouth 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.
Title: Re: Sega Model 2 Emulator Full Screen Shooter fix - RamjetM2Borderless - App
Post by: DarthMarino 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.
Title: Re: Sega Model 2 Emulator Full Screen Shooter fix - RamjetM2Borderless - App
Post by: Howard_Casto 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. 
Title: Re: Sega Model 2 Emulator Full Screen Shooter fix - RamjetM2Borderless - App
Post by: Trnzaddict 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.
Title: Re: Sega Model 2 Emulator Full Screen Shooter fix - RamjetM2Borderless - App
Post by: RamjetR 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
Title: Re: Sega Model 2 Emulator Full Screen Shooter fix - RamjetM2Borderless - App
Post by: RamjetR 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
Title: Re: Sega Model 2 Emulator Full Screen Shooter fix - RamjetM2Borderless - App
Post by: Howard_Casto 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. 
Title: Re: Sega Model 2 Emulator Full Screen Shooter fix - RamjetM2Borderless - App
Post by: RamjetR 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?

Title: Re: Sega Model 2 Emulator Full Screen Shooter fix - RamjetM2Borderless - App
Post by: Howard_Casto 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. 
Title: Re: Sega Model 2 Emulator Full Screen Shooter fix - RamjetM2Borderless - App
Post by: RamjetR 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.
Title: Re: Sega Model 2 Emulator Full Screen Shooter fix - RamjetM2Borderless - App
Post by: Howard_Casto 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. 
Title: Re: Sega Model 2 Emulator Full Screen Shooter fix - RamjetM2Borderless - App
Post by: vandale 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
Title: Re: Sega Model 2 Emulator Full Screen Shooter fix - RamjetM2Borderless - App
Post by: BadMouth 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 (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.
Title: Re: Sega Model 2 Emulator Full Screen Shooter fix - RamjetM2Borderless - App
Post by: BadMouth 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 (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.
Title: Re: Sega Model 2 Emulator Full Screen Shooter fix - RamjetM2Borderless - App
Post by: Howard_Casto 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. 
Title: Re: Sega Model 2 Emulator Full Screen Shooter fix - RamjetM2Borderless - App
Post by: Howard_Casto 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.  ;)
Title: Re: Sega Model 2 Emulator Full Screen Shooter fix - RamjetM2Borderless - App
Post by: BadMouth 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.
Title: Re: Sega Model 2 Emulator Full Screen Shooter fix - RamjetM2Borderless - App
Post by: Endprodukt on January 23, 2013, 04:02:23 pm
I have two lightguns and will test it for you. What information do you actually need?
Title: Re: Sega Model 2 Emulator Full Screen Shooter fix - RamjetM2Borderless - App
Post by: Howard_Casto 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.....
Title: AW: Sega Model 2 Emulator Full Screen Shooter fix - RamjetM2Borderless - App
Post by: Endprodukt 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.
Title: Re: Sega Model 2 Emulator Full Screen Shooter fix - RamjetM2Borderless - App
Post by: vandale 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 (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
Title: Sega Model 2 Emulator Full Screen Shooter fix - RamjetM2Borderless - App
Post by: TIGER8855 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.
Title: Re: Sega Model 2 Emulator Full Screen Shooter fix - RamjetM2Borderless - App
Post by: BadMouth 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.
Title: Re: Sega Model 2 Emulator Full Screen Shooter fix - RamjetM2Borderless - App
Post by: BadMouth 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. 
Title: Re: Sega Model 2 Emulator Full Screen Shooter fix - RamjetM2Borderless - App
Post by: BadMouth 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 (http://www.youtube.com/watch?v=5FFjnkxl0C4#ws)

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

Act Labs rawtest 2 (http://www.youtube.com/watch?v=0vvLCH_Tjrk#ws)

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

AimTrak rawtest 1 (http://www.youtube.com/watch?v=e1DDBkU1gZs#ws)

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.
Title: Re: Sega Model 2 Emulator Full Screen Shooter fix - RamjetM2Borderless - App
Post by: Howard_Casto 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. 
Title: Re: Sega Model 2 Emulator Full Screen Shooter fix - RamjetM2Borderless - App
Post by: Howard_Casto 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. 
Title: Re: Sega Model 2 Emulator Full Screen Shooter fix - RamjetM2Borderless - App
Post by: vandale 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
Title: Re: Sega Model 2 Emulator Full Screen Shooter fix - RamjetM2Borderless - App
Post by: Howard_Casto 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. 
Title: Re: Sega Model 2 Emulator Full Screen Shooter fix - RamjetM2Borderless - App
Post by: BadMouth 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 (http://www.youtube.com/watch?v=rU6e5HURdJM#ws)

Act Labs on 800x600 CRT TV over S-Video
rawtest2 Act Labs (http://www.youtube.com/watch?v=-QfjknzDVQk#ws)
(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?
Title: Re: Sega Model 2 Emulator Full Screen Shooter fix - RamjetM2Borderless - App
Post by: Howard_Casto 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. 
Title: Re: Sega Model 2 Emulator Full Screen Shooter fix - RamjetM2Borderless - App
Post by: Howard_Casto 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. 
Title: Re: Sega Model 2 Emulator Full Screen Shooter fix - RamjetM2Borderless - App
Post by: BadMouth 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.
Title: Re: Sega Model 2 Emulator Full Screen Shooter fix - RamjetM2Borderless - App
Post by: BadMouth 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.
Title: Re: Sega Model 2 Emulator Full Screen Shooter fix - RamjetM2Borderless - App
Post by: BadMouth 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.
Title: Re: Sega Model 2 Emulator Full Screen Shooter fix - RamjetM2Borderless - App
Post by: BadMouth 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.
Title: Re: Sega Model 2 Emulator Full Screen Shooter fix - RamjetM2Borderless - App
Post by: Howard_Casto 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.
Title: Re: Sega Model 2 Emulator Full Screen Shooter fix - RamjetM2Borderless - App
Post by: Howard_Casto 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. 
Title: Re: Sega Model 2 Emulator Full Screen Shooter fix - RamjetM2Borderless - App
Post by: BadMouth 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.
Title: Re: Sega Model 2 Emulator Full Screen Shooter fix - RamjetM2Borderless - App
Post by: Howard_Casto 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....
Title: Re: Sega Model 2 Emulator Full Screen Shooter fix - RamjetM2Borderless - App
Post by: Howard_Casto on January 24, 2013, 11:16:26 pm
Ok, last one for tonight.  This hopefully should do it .....stupid twips ruin everything. 
Title: Re: Sega Model 2 Emulator Full Screen Shooter fix - RamjetM2Borderless - App
Post by: BadMouth 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.
Title: Re: Sega Model 2 Emulator Full Screen Shooter fix - RamjetM2Borderless - App
Post by: Howard_Casto 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. 
Title: Re: Sega Model 2 Emulator Full Screen Shooter fix - RamjetM2Borderless - App
Post by: Endprodukt on January 25, 2013, 05:11:03 am
This is so exciting... feels like you're almost there :)
Title: Re: Sega Model 2 Emulator Full Screen Shooter fix - RamjetM2Borderless - App
Post by: BadMouth 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.
Title: Re: Sega Model 2 Emulator Full Screen Shooter fix - RamjetM2Borderless - App
Post by: Howard_Casto 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. 

Title: Re: Sega Model 2 Emulator Full Screen Shooter fix - RamjetM2Borderless - App
Post by: Howard_Casto 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. 
Title: AW: Sega Model 2 Emulator Full Screen Shooter fix - RamjetM2Borderless - App
Post by: Endprodukt on January 26, 2013, 05:23:56 am
What about demul support ? That would be nice.
Title: Re: Sega Model 2 Emulator Full Screen Shooter fix - RamjetM2Borderless - App
Post by: RamjetR 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...
Title: Re: Sega Model 2 Emulator Full Screen Shooter fix - RamjetM2Borderless - App
Post by: Howard_Casto 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.
Title: Re: Sega Model 2 Emulator Full Screen Shooter fix - RamjetM2Borderless - App
Post by: Howard_Casto 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. 
Title: AW: Sega Model 2 Emulator Full Screen Shooter fix - RamjetM2Borderless - App
Post by: Endprodukt 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.
Title: Re: Sega Model 2 Emulator Full Screen Shooter fix - RamjetM2Borderless - App
Post by: Howard_Casto 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.  ;)
Title: Re: Sega Model 2 Emulator Full Screen Shooter fix - RamjetM2Borderless - App
Post by: Endprodukt on January 27, 2013, 12:04:57 pm
if you need someone for testing I'm in!
Title: Re: Sega Model 2 Emulator Full Screen Shooter fix - RamjetM2Borderless - App
Post by: BadMouth 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.

Title: AW: Sega Model 2 Emulator Full Screen Shooter fix - RamjetM2Borderless - App
Post by: Endprodukt on January 28, 2013, 03:14:03 am
Will do that today. :)
Title: Re: Sega Model 2 Emulator Full Screen Shooter fix - RamjetM2Borderless - App
Post by: Endprodukt 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.
Title: Re: Sega Model 2 Emulator Full Screen Shooter fix - RamjetM2Borderless - App
Post by: Howard_Casto 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!
Title: Re: Sega Model 2 Emulator Full Screen Shooter fix - RamjetM2Borderless - App
Post by: Endprodukt 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.
Title: Re: Sega Model 2 Emulator Full Screen Shooter fix - RamjetM2Borderless - App
Post by: ArcadeBliss 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 :)
Title: Re: Sega Model 2 Emulator Full Screen Shooter fix - RamjetM2Borderless - App
Post by: Howard_Casto 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. 
Title: Re: Sega Model 2 Emulator Full Screen Shooter fix - RamjetM2Borderless - App
Post by: Endprodukt 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:
Title: Re: Sega Model 2 Emulator Full Screen Shooter fix - RamjetM2Borderless - App
Post by: RamjetR 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

Title: Re: Sega Model 2 Emulator Full Screen Shooter fix - RamjetM2Borderless - App
Post by: Howard_Casto 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). 
Title: Re: Sega Model 2 Emulator Full Screen Shooter fix - RamjetM2Borderless - App
Post by: RamjetR 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?


Title: Re: Sega Model 2 Emulator Full Screen Shooter fix - RamjetM2Borderless - App
Post by: Howard_Casto 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. 
Title: Re: Sega Model 2 Emulator Full Screen Shooter fix - RamjetM2Borderless - App
Post by: vandale 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
Title: Re: Sega Model 2 Emulator Full Screen Shooter fix - RamjetM2Borderless - App
Post by: Howard_Casto 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. 
Title: Re: Sega Model 2 Emulator Full Screen Shooter fix - RamjetM2Borderless - App
Post by: Howard_Casto 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.  ;)
Title: Re: Sega Model 2 Emulator Full Screen Shooter fix - RamjetM2Borderless - App
Post by: Howard_Casto 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. 
Title: AW: Sega Model 2 Emulator Full Screen Shooter fix - RamjetM2Borderless - App
Post by: Endprodukt 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.
Title: Re: Sega Model 2 Emulator Full Screen Shooter fix - RamjetM2Borderless - App
Post by: Howard_Casto 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. 
Title: Re: Sega Model 2 Emulator Full Screen Shooter fix - RamjetM2Borderless - App
Post by: RamjetR 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
Title: Re: Sega Model 2 Emulator Full Screen Shooter fix - RamjetM2Borderless - App
Post by: Howard_Casto 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. 
Title: Re: Sega Model 2 Emulator Full Screen Shooter fix - RamjetM2Borderless - App
Post by: Howard_Casto 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. 
Title: Re: Sega Model 2 Emulator Full Screen Shooter fix - RamjetM2Borderless - App
Post by: Howard_Casto 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. 
Title: Re: Sega Model 2 Emulator Full Screen Shooter fix - RamjetM2Borderless - App
Post by: vandale on February 01, 2013, 01:46:12 am
looks promising, great work  :applaud:
Title: Re: Sega Model 2 Emulator Full Screen Shooter fix - RamjetM2Borderless - App
Post by: Howard_Casto 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. 
Title: Re: Sega Model 2 Emulator Full Screen Shooter fix - RamjetM2Borderless - App
Post by: retrorepair 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!
Title: Re: Sega Model 2 Emulator Full Screen Shooter fix - RamjetM2Borderless - App
Post by: RamjetR 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!

Title: Re: Sega Model 2 Emulator Full Screen Shooter fix - RamjetM2Borderless - App
Post by: Howard_Casto 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). 
Title: Re: Sega Model 2 Emulator Full Screen Shooter fix - RamjetM2Borderless - App
Post by: Howard_Casto 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. 
Title: Re: Sega Model 2 Emulator Full Screen Shooter fix - RamjetM2Borderless - App
Post by: BadMouth 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!
Title: Re: Sega Model 2 Emulator Full Screen Shooter fix - RamjetM2Borderless - App
Post by: Wade007 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/ (http://www.cheapskategamer.com/pc_game_stories_and_news/true-light-gun-support-for-pc-gaming-the-arcade-guns%E2%84%A2-product-review/)


Title: Re: Sega Model 2 Emulator Full Screen Shooter fix - RamjetM2Borderless - App
Post by: Howard_Casto 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. 
Title: Re: Sega Model 2 Emulator Full Screen Shooter fix - RamjetM2Borderless - App
Post by: Howard_Casto 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. 

Title: Re: Sega Model 2 Emulator Full Screen Shooter fix - RamjetM2Borderless - App
Post by: Howard_Casto 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. 
Title: Re: Sega Model 2 Emulator Full Screen Shooter fix - RamjetM2Borderless - App
Post by: vandale 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
Title: Re: Sega Model 2 Emulator Full Screen Shooter fix - RamjetM2Borderless - App
Post by: Howard_Casto 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. 
Title: Re: Sega Model 2 Emulator Full Screen Shooter fix - RamjetM2Borderless - App
Post by: Endprodukt on February 03, 2013, 08:23:24 am
Awesome news! You're the man! :D
Title: Re: Sega Model 2 Emulator Full Screen Shooter fix - RamjetM2Borderless - App
Post by: Howard_Casto 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. 
Title: Re: Sega Model 2 Emulator Full Screen Shooter fix - RamjetM2Borderless - App
Post by: Howard_Casto 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. 
Title: Re: Sega Model 2 Emulator Full Screen Shooter fix - RamjetM2Borderless - App
Post by: vandale on February 03, 2013, 07:57:03 pm
woop woop
Title: Re: Sega Model 2 Emulator Full Screen Shooter fix - RamjetM2Borderless - App
Post by: Howard_Casto 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. 

Title: Re: Sega Model 2 Emulator Full Screen Shooter fix - RamjetM2Borderless - App
Post by: Howard_Casto 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. 
Title: Re: Sega Model 2 Emulator Full Screen Shooter fix - RamjetM2Borderless - App
Post by: Howard_Casto 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. 
Title: AW: Sega Model 2 Emulator Full Screen Shooter fix - RamjetM2Borderless - App
Post by: Endprodukt 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.
Title: Re: Sega Model 2 Emulator Full Screen Shooter fix - RamjetM2Borderless - App
Post by: Howard_Casto 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. 
Title: AW: Sega Model 2 Emulator Full Screen Shooter fix - RamjetM2Borderless - App
Post by: Endprodukt 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?
Title: Re: Sega Model 2 Emulator Full Screen Shooter fix - RamjetM2Borderless - App
Post by: Howard_Casto 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. 
Title: Re: Sega Model 2 Emulator Full Screen Shooter fix - RamjetM2Borderless - App
Post by: Trnzaddict 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.
Title: Re: Sega Model 2 Emulator Full Screen Shooter fix - RamjetM2Borderless - App
Post by: Howard_Casto 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. 
Title: Re: Sega Model 2 Emulator Full Screen Shooter fix - RamjetM2Borderless - App
Post by: RamjetR 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.

Title: Re: Sega Model 2 Emulator Full Screen Shooter fix - RamjetM2Borderless - App
Post by: Howard_Casto 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. 
Title: Re: Sega Model 2 Emulator Full Screen Shooter fix - RamjetM2Borderless - App
Post by: BadMouth 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.
Title: Re: Sega Model 2 Emulator Full Screen Shooter fix - RamjetM2Borderless - App
Post by: Howard_Casto 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. 
Title: Re: Sega Model 2 Emulator Full Screen Shooter fix - RamjetM2Borderless - App
Post by: Howard_Casto 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. 
Title: Re: Sega Model 2 Emulator Full Screen Shooter fix - RamjetM2Borderless - App
Post by: RamjetR 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
Title: Re: Sega Model 2 Emulator Full Screen Shooter fix - RamjetM2Borderless - App
Post by: RamjetR 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.
Title: Re: Sega Model 2 Emulator Full Screen Shooter fix - RamjetM2Borderless - App
Post by: Howard_Casto 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...
Title: Re: Sega Model 2 Emulator Full Screen Shooter fix - RamjetM2Borderless - App
Post by: RamjetR 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?
Title: Re: Sega Model 2 Emulator Full Screen Shooter fix - RamjetM2Borderless - App
Post by: RamjetR 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.
Title: Re: Sega Model 2 Emulator Full Screen Shooter fix - RamjetM2Borderless - App
Post by: RamjetR 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...
Title: Re: Sega Model 2 Emulator Full Screen Shooter fix - RamjetM2Borderless - App
Post by: Howard_Casto 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....
Title: Re: Sega Model 2 Emulator Full Screen Shooter fix - RamjetM2Borderless - App
Post by: RamjetR 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...

Title: Re: Sega Model 2 Emulator Full Screen Shooter fix - RamjetM2Borderless - App
Post by: vandale 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
Title: Re: Sega Model 2 Emulator Full Screen Shooter fix - RamjetM2Borderless - App
Post by: Howard_Casto 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. 
Title: Re: Sega Model 2 Emulator Full Screen Shooter fix - RamjetM2Borderless - App
Post by: Howard_Casto 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. 
Title: Re: Sega Model 2 Emulator Full Screen Shooter fix - RamjetM2Borderless - App
Post by: Howard_Casto 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. 
Title: Re: Sega Model 2 Emulator Full Screen Shooter fix - RamjetM2Borderless - App
Post by: Howard_Casto 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!
Title: AW: Sega Model 2 Emulator Full Screen Shooter fix - RamjetM2Borderless - App
Post by: Endprodukt on February 06, 2013, 08:42:32 am
Awesome news! Great work, can't wait :)
Title: Re: Sega Model 2 Emulator Full Screen Shooter fix - RamjetM2Borderless - App
Post by: RamjetR 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 :)
Title: Re: Sega Model 2 Emulator Full Screen Shooter fix - RamjetM2Borderless - App
Post by: Howard_Casto 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.
Title: Re: Sega Model 2 Emulator Full Screen Shooter fix - RamjetM2Borderless - App
Post by: Howard_Casto 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. 
Title: Re: Sega Model 2 Emulator Full Screen Shooter fix - RamjetM2Borderless - App
Post by: BadMouth 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?
Title: Re: Sega Model 2 Emulator Full Screen Shooter fix - RamjetM2Borderless - App
Post by: nipsmg 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.

Title: Re: Sega Model 2 Emulator Full Screen Shooter fix - RamjetM2Borderless - App
Post by: Howard_Casto 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. 
Title: Re: Sega Model 2 Emulator Full Screen Shooter fix - RamjetM2Borderless - App
Post by: Howard_Casto 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. 
Title: Re: Sega Model 2 Emulator Full Screen Shooter fix - RamjetM2Borderless - App
Post by: Howard_Casto 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. 
Title: Re: Sega Model 2 Emulator Full Screen Shooter fix - RamjetM2Borderless - App
Post by: Howard_Casto 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. 
Title: Re: Sega Model 2 Emulator Full Screen Shooter fix - RamjetM2Borderless - App
Post by: Howard_Casto 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. 
Title: Re: Sega Model 2 Emulator Full Screen Shooter fix - RamjetM2Borderless - App
Post by: Howard_Casto on February 08, 2013, 05:59:21 pm
I thought instead of killing myself with the model 2 stuff, I'd implement the remaining PC games this weekend to retain original troubleshooter functionality. 

I've got hotd3 and hotd working.  I'll also test hotd2 and that's the last of those games I own.  My guess is hotd3 is the only one anybody cares about seeing as how it's the one that's unemulated, but I'll do it anyway. 

I'm kind of dreading doing HOTD 2, because there are literally 5 versions in the original troubleshooter.ini  It looks like he used a combination of exe signatures and exe names to auto-detect which version to use.  I'm not going to bloat my code and ini files with that.  The user should be able to figure out which version they are using via the packaging it came in.  Either that, or I'll do some sort of branching ini, because I don't want to have an ini 5 pages long for hotd2. 

There's a similar issue with virtua cop, but not nearly as bad.  I think there are two versions. 

Anyway, thus far no problems with all the new code.... the pc games work flawlessly. 

Also the joystick implementation in hotd and hotd2 is terrible!  Mine works much better ;)
Title: Re: Sega Model 2 Emulator Full Screen Shooter fix - RamjetM2Borderless - App
Post by: RamjetR on February 08, 2013, 07:13:18 pm
Great work Howard.

I don't think there is much more we can do to assist anymore, looks like it's pretty much a process of cleaning and gui'ing. I'm back on call for work this week (still cleaning up the cyclone mess and damage) so any spare time I had is now out the window again. Let me know if there is anything you need us to do. Especially in the field of beta testing  ;)

The M2emulator has been out for years and it's great to see a few dedicated ppl get together and just have a go at fixing what was left to be done. M2 in it's own right has to be one of the best emulators out there, and I'm kinda proud to have been involved in what's being achieved here.

I may be able to get back to finishing my home automation project I started a few weeks ago now. Arduino code done, IR blaster interface done, WiFi/LAN setup done, 433MHz TX/RX interface for RF Power points done, PIR motion detectors and P&T Cameras done. Evenghost web UI and server almost finished. I'm using my iPhone to be detected on the LAN to unlock the house, turn off the alarms, Switch on the exterior and some interior lighting (at night) through wifi. It's kinda cool as I pull up to the house, the phone logs onto the LAN and suddenly everything comes to life on the house before I've even got out the car :)

I'm such a geek...

Title: Re: Sega Model 2 Emulator Full Screen Shooter fix - RamjetM2Borderless - App
Post by: Howard_Casto on February 08, 2013, 09:04:17 pm
Well if anybody wants to have a go at figuring out how to manipulate the cross hairs in m2 for the sake of the the lightgun games, that would be extremely helpful.  Ditto for figuring out what the heck is going on with BEL's y axis for p2, but I don't think it would be easy until I actually release the troubleshooter. 

We are at least a week away from a release.  thus far I've (wisely) been writing ini files by hand since I add new, necessary, features as I go.  I've yet to do any real work on the gui, that allows users to configure their controllers, set the paths to exes, ect...  Then I've got to take the code from our earlier rawmouse experiments and put it into use. 

Then there are just some nice features I'd like to add, like "hiding" the crosshairs for real lightgun users (I actually just move the cursor offscreen until a button is pressed).  I also want to add an offscreen reload, in that if a x or y value is absolute 0 (0%) or absolute 1 (100%) and the trigger is pressed, I'll press the reload button instead.  I also want to add the ability to write to ini files (already there, for my own purposes, I just have to make a function) and the registry.  HOTD3 owners will appreciate that last one a lot.  I probably need to also add the option to launch an additional program as wiimote users will need to launch glovepie scripts. 


But there are minor things I could sure use some help with.  There are more than a few model 2 games that I haven't fully figured out the outputs to yet... some of them should be simple to determine, like start lamps.  I'll see if I can get a list together tonight. 

Oh and also..... a logo would be nice for when I upload it to my homepage.  I'm thinking cheesy action sequel motif.  Maybe use a wiimote and a ultimarc gun to make the "II"?

Troubleshooter II:   Shoot Harder   ;)

You never did send me your info on Outrun 2k6 either. 

Yeah after I get this done we are going to have to trade notes in regards to hardware projects... you are better at it than me and I have some ideas. 
Title: Re: Sega Model 2 Emulator Full Screen Shooter fix - RamjetM2Borderless - App
Post by: Howard_Casto on February 08, 2013, 11:58:32 pm
Got all of the hotd2's in. 

I'll do virtua cop (not squad) later this weekend. 

Thus far no real issues. 
Title: Re: Sega Model 2 Emulator Full Screen Shooter fix - RamjetM2Borderless - App
Post by: Howard_Casto on February 09, 2013, 01:29:12 am
Went ahead and did the V Cops since there were only two more to go. 

So aside from epsxe (which I think has proper lightgun support at this point) and die hard (which does dx hooking so I'm skipping it) T2 now supports all the stuff the original did. 

If somebody that uses epsxe can confirm I would appreciate it.  I doubt it would be terribly hard to implement, but epsxe is in active development again, so it makes more sense to just ask the devs to do it. 
Title: AW: Sega Model 2 Emulator Full Screen Shooter fix - RamjetM2Borderless - App
Post by: Endprodukt on February 09, 2013, 05:07:08 am
Psx works just fine.
Title: Re: Sega Model 2 Emulator Full Screen Shooter fix - RamjetM2Borderless - App
Post by: RamjetR on February 09, 2013, 08:10:45 am
Troubleshooter II:   Shoot Harder   ;)

You never did send me your info on Outrun 2k6 either. 

Yeah after I get this done we are going to have to trade notes in regards to hardware projects... you are better at it than me and I have some ideas.

Hahaha I love the name.

Outrun stuff isn't complete... it was something I started july last year on x-sim 2.0 to use the output data for a motion simulator I had many intentions to build before errr last christmas. Then I bought a house and spent a month renovating it, then it was a hernia and surgery and rehab and... holy crap it's february!!! Since installing x-sim 3.0 apparently I can't load the profiles without a stage 2 key which also apparently needs community input in the form of a project post build log to show that I'm using it to claim a free key. I'll gather all I have and try to put together something which might be useful soon. I really want a FF Outrun too, so looking forward to working on that again...

Yeah if you have some cool hardware project idea's I can help you with that. I'm putting together my own arduino LED controller for mame and funky stuff. It's native USB(virtual serial comm port) which makes it nice and easy to talk to. Expandable and fast. Coupled with a small array of SSR's it will drive large DC and AC loads (ie Motion simulators). Perks of being an electronics engineer :)

On a side note, today I managed to make my own HID code for a LeoStick (Freetronics) arduino to make a USB interface for a number of old joysticks I had laying round in the cupboards. Found my old Bug from the Atari ST and even an original Atari single button joystick which are all now USB compatible :) Now wasn't that fun making my own HID descriptor from the USB.org information!

Funny enough, if this troubleshooter stuff didn't work. I had a backup arduino sketch to mimic a second real USB mouse and an AHK script to send the X/Y and trigger info over serial to emulate a real second mouse like a dongle of sorts... it works too :) But the software is a much better idea lol.

Oh.... regarding off screen reloading? was that for PC version of the games or Model 2?
Title: Re: Sega Model 2 Emulator Full Screen Shooter fix - RamjetM2Borderless - App
Post by: Howard_Casto on February 09, 2013, 10:35:57 pm
Either/And in regards to the off screen reload. 

I'm thinking on second though that it might not be necessay though.  I know the act labs gun press the second mouse button when you fire off screen.  I'm sure it's similar for the aim tracks.  That just leaves the joysticks and since they are only in place for wiimote scripts anyway, the script itself could be coded for offscreen reloading. 


For outrun, I'm pretty sure there is some ff code buried deep within.... the stupid thing comes with a "motion" folder, which was on the xbox disc and contained all the ff effects.  Sadly dumping all the xbox files into the folder doesn't do anything.  As you suggested in the other thread, we can use the car physics if needed.  The yaw, pitch and roll of the car could be used for motion sim, a check for sudden shifts in z height could be used for rumble and any drift physics could be used for the wheel.  I wish I could find a copy of the 360 arcade version as well.  The textures in the pc version are the only thing that hasn't aged well, so it'd be nice to swap those out. 

I've got a strange question for you guys, I don't know if anyone would know the answer.  Does anyone know how to run the pc version of house of the dead in windowed mode?  I'm trying to improve functionality on the original troubleshooter and for most games I've managed to do that.  Menus that were once delegated to "you'll have to whip out the keyboard and mouse" are now navigable via the lightgun and/or the coin buttons.  But hotd has this stupid skeleton hand for a cursor in the main menu.  I can control it via the arrow keys, so it's a passive value but as the game only runs in fullscreen I can't figure out how to search for it.  I wasn't going to bother, it's a fairly crappy port, but then I found out that there is this cheat code that lets you tweak all the firing physics for the characters, which makes it worth it to me. 

It should be fairly easy to find the address, if I can just get the thing running in windowed mode. 

Anyway I'm fairly burnt out on this and every time I say "I'm going to take a break" I end up working on it again, so I haven't done anything today.  I'll get a list of missing outputs ready though, everybody can help with that. 
Title: Re: Sega Model 2 Emulator Full Screen Shooter fix - RamjetM2Borderless - App
Post by: RamjetR on February 09, 2013, 11:15:44 pm
Either/And in regards to the off screen reload. 

I'm thinking on second though that it might not be necessay though.  I know the act labs gun press the second mouse button when you fire off screen.  I'm sure it's similar for the aim tracks.  That just leaves the joysticks and since they are only in place for wiimote scripts anyway, the script itself could be coded for offscreen reloading. 

For outrun, I'm pretty sure there is some ff code buried deep within.... the stupid thing comes with a "motion" folder, which was on the xbox disc and contained all the ff effects.  Sadly dumping all the xbox files into the folder doesn't do anything.  As you suggested in the other thread, we can use the car physics if needed.  The yaw, pitch and roll of the car could be used for motion sim, a check for sudden shifts in z height could be used for rumble and any drift physics could be used for the wheel.  I wish I could find a copy of the 360 arcade version as well.  The textures in the pc version are the only thing that hasn't aged well, so it'd be nice to swap those out. 

I've got a strange question for you guys, I don't know if anyone would know the answer.  Does anyone know how to run the pc version of house of the dead in windowed mode?  I'm trying to improve functionality on the original troubleshooter and for most games I've managed to do that.  Menus that were once delegated to "you'll have to whip out the keyboard and mouse" are now navigable via the lightgun and/or the coin buttons.  But hotd has this stupid skeleton hand for a cursor in the main menu.  I can control it via the arrow keys, so it's a passive value but as the game only runs in fullscreen I can't figure out how to search for it.  I wasn't going to bother, it's a fairly crappy port, but then I found out that there is this cheat code that lets you tweak all the firing physics for the characters, which makes it worth it to me. 

It should be fairly easy to find the address, if I can just get the thing running in windowed mode. 

Anyway I'm fairly burnt out on this and every time I say "I'm going to take a break" I end up working on it again, so I haven't done anything today.  I'll get a list of missing outputs ready though, everybody can help with that. 

DarthMarino's video worked with offscreen reloading out of the box with the Fullscreen Borderless app. I think that was an AimTrak powered gun, so I imagine thats what it's doing when shot out of calibration zone. The Joystick/Wiimote script should be able to do that on it's own.

HOTD3, I don't have... tried the good ol' ALT+Enter trick? or -window in the commandline perhaps?

OutRun2006 will come, its just going to take some time like everything else we're trying to do at the same time. I'm babysitting again today and finishing off some arduino web code to pretty up the interface a bit whilst she's asleep...

I took some time out last night (till early hours) to test and configure my new PC EventGhost home automation/security alarm setup. I'm kinda chuffed to see it all come together with;

* Web accessible control system
* iPhone Mac+IP LAN physical detection security alarm activate/disable
* PIR Motion detection and event handling
* New (thanks to the YAWCAM Dev) command line control of Webcams and IP cam's around the house for alarm reporting
* Email alerts for security breaches
* Automated Voice and "Fake" dog responses to alarm inputs... Actually this one is quite cool. On motion detect (or any event for that matter), I have the PC in the living room play a wav file of my girlfriend asking me if I want a drink (or similar) and then send a command to the computer room PC at the rear of the house which will reply with another wav file of me responding. From outside, you wouldn't know there wasn't a legitimate conversation going on.
* IR Blaster - Can at times of the day or in response to alarm conditions; Turn on the TV and Amplifier... Change channels and general channel surf (as if someone is in the house and watching TV). Also it can turn on the Air Conditioning with more precise control that the single on/off on the remote. If it has a IR remote... I can control it remotely or automatically in a script.
* 433MHz Transceiver - For those RF remote controller Power GPO's that you can get. Can now automatically turn off GPO's at either times of the day, or loss of presence of my iPhone (meaning I've left the house) etc....
* Wake-on-LAN & Shutdown - Can now remotely turn on any of my PC's (including Arcades Cabinets) and turn them off remotely as well.

* Currently coding up the remote start of applications - This one will automatically launch a program on a remote PC on a start trigger from the emulator on my PC... i.e. Launch a Network link M2 Daytona? and it sends the command to the PC next to it to do the same. No more trying to time the press start "now". Control the launching of all the linked machines from any them. Launch one game and the rest will follow :) This may have been done elsewhere, but this one ties in with the entire house automation idea. 

Most of the coding for the interface I have done myself with some help from a couple of industry standard libraries in arduino. Most of the hardwork is done with EventGhost... which honestly I think is up for program of the year for me... seriously cool stuff to be done with this free program.

I have only Voice activation left to do and trying to decide if purchasing RFID reader and tags is a better way than having the LAN detect the presence of my phone near the house for unlocking the door. Oh building my automated Vulcan EBF chain gun sentry turret... Need a decent Pan and Tilt platform for that.
Title: Re: Sega Model 2 Emulator Full Screen Shooter fix - RamjetM2Borderless - App
Post by: Howard_Casto on February 10, 2013, 12:01:45 am
Yeah it's the original hotd, not hotd3.  Hotd3 is the only pc game on the list that I actually cared about and fortunately it's working perfectly. 

I've tried everything I can think of to get hotd in windowed mode.  I technically can....  I can used the dxwnd program I used when I wrote my type X wrappers to force it into windowed mode.  The only problem is once I click on the game window, it wrangles focus of the mouse and I can get back to the troubleshooter window. 

So my options are to open the memory editor, click on the game window, hope I get lucky, and if not close the game, scroll to the next memory section and start all over again.  That would take FOREVER. 

Need to do some minor cleanup on hotd2 as well. It's menus aren't controlled by the mouse period, so I'll have to use the coin button tirck that I did on hotd3 to add support. 


The pc games are working though, which is the important thing.  At least the ones I have on hand do (hotd 1-3).  I might have to try to track down vcop 1 (uggh) because the troubleshooter documentation mentions some sort of double reload nonsense. 


Anyway, minor progress.  I quickly added support for auto-detection of the exe name.  This is exclusively for model 2 use.  Since some of the pointers change depending upon the exe version, I have to have a different NOP section for each exe.  The m2 kit will use lua scripts to launch the troubleshooter, to make things easier for front-ends.  This way things will "just work" and the user won't have hardly any setup. 
Title: Re: Sega Model 2 Emulator Full Screen Shooter fix - RamjetM2Borderless - App
Post by: Howard_Casto on February 10, 2013, 03:57:28 am
Ok:

List of model 2 games that need their outputs figured out:

All fighting games -  There's a billboard system that was used on the sega candy cabs.  Basically each player has a 2-digit, 7 segment display to count wins and well as two "winner" lamps, one for each player.  This would be very tricky to find and yet quite cool if implemented.  Because 7-segment displays are involved the values would most likely be multi-plexed,  meaning you'd see the values of all 4 digits (and possibly the winner lamps) switched out one after another in the same space rapidly. 

Desert Tank:  I found a "fake" vr view value, similar to daytona at 0x5211A6 in the emulator space.  There are still the rumble effects for both guns to find.

ManxTT:  Found the lamps at 0x51403c  I *think* the motion data is at 0x514034 but it needs figured out. 

Motor Raid:  Found something related to the lamps at 0x500690  still don't know the motor data is laced in there somehow.  Found the actual lamps at 0x51945E

Indy 500:  lamps are at 0x559CA4 motor data at 0x559CA8, just like sega rally.  The motor data has different bounds though, so for completeness they need to be figured out.

Sega Ski:  lamps are at 0x559CA4  something to do with the clutch is at 0x500648, the motor is at 0x588238, but the byte seems multiplexed, so I'm unsure of the data.  I don't know a lot about this cabinet, so I'm not sure what to look for. 

Sega Touring Car Championship:  Uses the same outputs as rally championship. 

Top Skater:  I've got the data... it's just lamps so nothing too complex, although it appears that the second byte of lamp data is inverted.  Really need a video of this cab in action to understand what's going on. 

Wave Race:  Again, uses Rally Championship's addressess.  The piston data is all borked... we'd probably never get it working.


And I think that's it..... any other games I didn't mention either don't have outputs or I've fully figured them out. 

Mind you this is stuff we can do after the troubleshooter is released, but it'd be nice to have as many ini file ducks in a row as possible. 
Title: Re: Sega Model 2 Emulator Full Screen Shooter fix - RamjetM2Borderless - App
Post by: vandale on February 10, 2013, 05:19:17 am
Yeah it's the original hotd, not hotd3.  Hotd3 is the only pc game on the list that I actually cared about and fortunately it's working perfectly. 

I've tried everything I can think of to get hotd in windowed mode.  I technically can....  I can used the dxwnd program I used when I wrote my type X wrappers to force it into windowed mode.  The only problem is once I click on the game window, it wrangles focus of the mouse and I can get back to the troubleshooter window. 

So my options are to open the memory editor, click on the game window, hope I get lucky, and if not close the game, scroll to the next memory section and start all over again.  That would take FOREVER. 

Need to do some minor cleanup on hotd2 as well. It's menus aren't controlled by the mouse period, so I'll have to use the coin button tirck that I did on hotd3 to add support. 


The pc games are working though, which is the important thing.  At least the ones I have on hand do (hotd 1-3).  I might have to try to track down vcop 1 (uggh) because the troubleshooter documentation mentions some sort of double reload nonsense. 


Anyway, minor progress.  I quickly added support for auto-detection of the exe name.  This is exclusively for model 2 use.  Since some of the pointers change depending upon the exe version, I have to have a different NOP section for each exe.  The m2 kit will use lua scripts to launch the troubleshooter, to make things easier for front-ends.  This way things will "just work" and the user won't have hardly any setup.

I have pc vc 1 and 2, do you want me to upload and pm you the link?
Title: Re: Sega Model 2 Emulator Full Screen Shooter fix - RamjetM2Borderless - App
Post by: mike boss on February 10, 2013, 12:48:15 pm
I'm trying to follow this thread, but a lil confused.
What changes are being made to the program ?
I have this installed and have not yet tested it yet,
but I thought it was working with the some of the games flawlessly.

Are improvements being made ?
Title: AW: Sega Model 2 Emulator Full Screen Shooter fix - RamjetM2Borderless - App
Post by: Endprodukt on February 10, 2013, 12:49:01 pm
Two player lightgun support.
Title: Re: Sega Model 2 Emulator Full Screen Shooter fix - RamjetM2Borderless - App
Post by: Howard_Casto on February 10, 2013, 01:52:29 pm
I'm trying to follow this thread, but a lil confused.
What changes are being made to the program ?
I have this installed and have not yet tested it yet,
but I thought it was working with the some of the games flawlessly.

Are improvements being made ?

First off, what do you mean by changes to the program?  This is a NEW program.  I have no affiliation with the author of the original troubleshooter.

But to answer your question....

Tons:

The troubleshooter only supported act-labs guns for the most part. 

It only supported absolute pointing devices, in other words no trackballs or mice. 

No joystick support.  Wiimotes need joystick support to be used as lightguns.  You might think "but those games have joystick support" and yes they do, terrible joystick support.  ;)

Better menu support.   HOTD3 my best example of this.  During the game there are route selection screens.  The troubleshooter makes you press either start 1 or 2 to select.  This is a pain in the butt, especially if you have ir-based guns, because you'll have to recalibrate after walking back to the cabinet.  Now you can just shoot at your selection like originally intended. 

Model 2 support....  2 player lightguns just don't work in m2 due to a coding error, now two player MICE do.  Also joysticks don't work for the gun games, even the ones, like rail chase 2 that originally used joysticks. 

Output support, particularly for model 2.  Some of the games have force-feedback coded in, but that is not the same as output broadcasting...  M2 games with vr buttons as well as gun games with recoil benefit most from this. 


Now RamJet's original program removes the borders on the lightgun games when they launched.  Again this was to fix a coding error, because the borders remained in tact (although you couldn't see them) when m2 was in full screen and it  sometimes interfered with off-screen reloading.  Somehow the thread mutated into this though.  ;)
Title: Re: Sega Model 2 Emulator Full Screen Shooter fix - RamjetM2Borderless - App
Post by: mike boss on February 10, 2013, 02:21:12 pm
Ok, get it now.
Cool idea to modify (improve) the troubleshooter.

I installed RamJet's original program but never tested it out yet.
I loaded it and saw it worked cause as he said you get a lil logo in your system tray.

I'm interested to see how this goes.
I finally got my GunCon1 shells yesterday, plan is to mount my Aim Trak units into them.
I'd like to get all my gun info sorted out as some people suggest installing the troubleshooter patch anyway.
I'd like my guns to work with MAME and any/all emulators that support light gun games, not to mention a few choice PC games.

Keep up the awesome work guys.
Title: Re: Sega Model 2 Emulator Full Screen Shooter fix - RamjetM2Borderless - App
Post by: RamjetR on February 11, 2013, 04:12:44 am
Do I have to change the scripts included with the borderless app for troubleshooter or to include troubleshooter? Should it be released in a pack with Troubleshooter?

Title: Re: Sega Model 2 Emulator Full Screen Shooter fix - RamjetM2Borderless - App
Post by: Howard_Casto on February 11, 2013, 04:51:30 am
You are changing the window style correct?  I can just add support for it. 

Your's works flawlessly, but I'm afraid things are going to get hairy if we keep layering exes.  As is the poor wiimote users (aka me) are going to have to run this app, a glovepie script, and optionally mamehooker. 

I decided not to add optional support of launching additional apps btw.  Mamehooker can already do that and I've coded the troubleshooter so that you can launch batch files instead of a straight exe.  I've added a lot more stuff than I ever intended to get the m2 stuff working and I'm afraid of bloating the app to where it effects performance on lower end pcs. 

Did some of the straight output games this morning.  Ugh... I might just document them and have somebody else figure them out.  All the lamps are easy, I can add those in like 10 seconds, but the stupid motors take so much work.  You have to figure out the range of each direction and the only way to do that is to play the game and constantly pause to get the numbers, then test, then tweak again, ect....  For many it won't even matter...  m2 has built in ff afterall, but if you are doing a sim rig it would be nice to have those values to hook up to other things like pistons and rumble motors, ect.  Also the ff motors for games like super ski and ect are in there, but I don't think they are hooked up to ff. 

I would really like to get rail chase 2 figured out as well.  That's one of the few games that would be awesome on a motion rig. 

Anyway, I'm going to work on some internal things this morning.  Right now the memory regions get hammered with constant writes in the main loop.  I don't think this is really necessay, so I'll add a "persistent" option in the ini files and code so that by default a value is only written if it changes. 

I'll also have to add code to write to the input regions for model 2.  I'll go ahead and add options write regions for the cross-hairs as well.  I never did figure out where they were, but maybe somebody else can.  It annoys me that I can't find it.  Direct Draw/Direct 3d is the only part of an emulator that I actually understand, but If I can't find the address in memory, I can't mod it.
Title: Re: Sega Model 2 Emulator Full Screen Shooter fix - RamjetM2Borderless - App
Post by: Howard_Casto on February 11, 2013, 06:07:09 am
Ok added in the persistent code and it does seem to cut down on the overhead somewhat. 

I also did some minor hex snooping which lead me to fix the p2 y axis issue in Behind Enemy Lines it was the 5th, count em, 5th address in memory that allocates a buffer for the y axis that I needed to NOP. 

The fact that there are so many different locations in memory that do the exact same thing seriously confuses me.  Why would joystick/mouse allocation be done differently for different games?

Anyway I think aside from not finding the crosshairs that's the last of the functional issues that were left unresolved, so that's good. 
Title: Re: Sega Model 2 Emulator Full Screen Shooter fix - RamjetM2Borderless - App
Post by: Howard_Casto on February 11, 2013, 06:19:52 am
I found a nice little timesaver. 

I mentioned that I had to re-calculate the NOPs because the offsets are different depending upon the exe.  Well apparently the magic offset is 7b0, that is the difference in the offsets between the 32 bit exe and the 64bit one.  So all the 64 bit optimizations must occur at the beginning of the exe.  Now this is what I expected, but I don't know a lot about modern compiling techniques, so I wasn't sure.  This means that a task that could have taken me hours should now only take a few minutes. 

Gonna go do that now and then I'm done for the morning. 
Title: Re: Sega Model 2 Emulator Full Screen Shooter fix - RamjetM2Borderless - App
Post by: mike boss on February 11, 2013, 07:52:35 am
Pardon my ignorance,

so when all is said and done this will work in connection with most any light-gun's including Aim Trak guns ? And it will be made available here for download ?
Title: Re: Sega Model 2 Emulator Full Screen Shooter fix - RamjetM2Borderless - App
Post by: Howard_Casto on February 11, 2013, 07:53:41 am
yup
Title: Re: Sega Model 2 Emulator Full Screen Shooter fix - RamjetM2Borderless - App
Post by: mike boss on February 11, 2013, 08:03:04 am
Thanks Howard_Casto ,

You do a ton for this arcade world !
Keep up the awesome work !

Same to RamJet, thanks!

Looking forward to this.
Cant wait to have a kick --I'm attempting to get by the auto-censor and should be beaten after I re-read the rules-- cabinet with some awesome (flawless working) gun support !
Title: Re: Sega Model 2 Emulator Full Screen Shooter fix - RamjetM2Borderless - App
Post by: Howard_Casto on February 11, 2013, 08:10:38 am
Did some work with the sega vs billboard for the fighting games. 

I found the data at 0x559CA8, which is the standard location, but I can't figure it out, so somebody with a bit more experience is going to have to look at it.  It is indeed multi-plexed and it does throw the winner lamps into the same byte that controls the 7 segment display. 

In the test menu, the p1 winner lamp shoots out a value of 144 and the p2 lamp a value of 152 but these are NOT the bitmask values... they can't be because they aren't powers of 2.  So there is an address register in there somewhere and then the value.  My guess would be the registers are a low value, like 4 or 8 and then the rest of the number is the 7 seg code.  Maybe a look at some 7 segment displays in mame would help, I dunno. 
Title: Re: Sega Model 2 Emulator Full Screen Shooter fix - RamjetM2Borderless - App
Post by: Howard_Casto on February 11, 2013, 04:10:56 pm
I thought I might add the ability to close the emulator with some optional exit keys so I went ahead and put that in.  Every single pc game as well as m2 exit with the press of alt+f4, so that makes things easy. 

I thought about it though and I'm going to have to make a generic ini file for the rest of the model 2 games.  It'd be a pain in the butt to rig up an exit key solution for only the games that don't have outputs or guns. 
Title: Re: Sega Model 2 Emulator Full Screen Shooter fix - RamjetM2Borderless - App
Post by: Howard_Casto on February 12, 2013, 01:07:11 am
Well I started hooking up that elusive trigger/reload code. 

The good news is that it works.  The bad news is my bitmasking code is bad or something so I'm not sending the correct values.  It's getting late, so I'll look at it tomorrow. 
Title: Re: Sega Model 2 Emulator Full Screen Shooter fix - RamjetM2Borderless - App
Post by: Howard_Casto on February 12, 2013, 11:30:41 am
Well there are more issues with the reload code than I expected. 

After working on it all last night I determined that the "down" trick doesn't work as I thought it did.  I dunno why I was working before... maybe a combination of different NOPs I tried had disabled it or something, but it isn't working now. 

Now I did manage to use the reload info I had found previously to get vcop working, and it works just fine, but the other games don't.

So to clarify:

vcop 100% working
gunblade 100% working
rail chase 2 100% working

behind enemy lines - grenade button not working
vcop 2 - reload button not working
hotd - reload button not working.


It might be one of those deals like the axis, where there are multiple writes and I just have to find the correct one for each game.  Honestly I'm tired now though, so I'll work on it tomorrow. 
Title: Re: Sega Model 2 Emulator Full Screen Shooter fix - RamjetM2Borderless - App
Post by: Howard_Casto on February 12, 2013, 08:46:11 pm
Ok I'm starting to understand why vcop is a special case now.  It seems that all the lightgun games have an extra bit for reload. 

For vcop it's at +18F7BC and values are ADDED to a buffer for the reload signal... in other words it's 0 when nobody is reloading, 1 for p1 reload , 2 for p2 and 3 for both. 

For hotd it's at +18F7DC and the values are SUBTRACTED to a buffer for reload...  3 for no reload, 2 for p1, 1 for P2 and 0 for both. 


So yeah I figured out HOTD at least, and maybe the others work this way as well.  One thing is certain... the reload procedure is so complex for these m2 games (on top of this I have to freeze the keyboard input and simulate a trigger press to reload) that I'm going to have to hard-code some functions for them... which sucks because I wanted to keep things as generic as possible. 


**update**

I remembered that hotd and vcop2 have more similar hardware than the original vcop, so I looked and sure enough, the addresses for hotd work for vcop2 as well! 

So now all that's left is the annoying Behind Enemy Lines...  AGAIN
I'm actually busy this week so I'm not sure how much I'll get done.  I just worked on it a little tonight to make sure my original idea for reload wasn't a dead end. 
Title: Re: Sega Model 2 Emulator Full Screen Shooter fix - RamjetM2Borderless - App
Post by: RamjetR on February 12, 2013, 09:05:56 pm
Ok I'm starting to understand why vcop is a special case now.  It seems that all the lightgun games have an extra bit for reload. 

For vcop it's at +18F7BC and values are ADDED to a buffer for the reload signal... in other words it's 0 when nobody is reloading, 1 for p1 reload , 2 for p2 and 3 for both. 

For hotd it's at +18F7DC and the values are SUBTRACTED to a buffer for reload...  3 for no reload, 2 for p1, 1 for P2 and 0 for both. 


So yeah I figured out HOTD at least, and maybe the others work this way as well.  One thing is certain... the reload procedure is so complex for these m2 games (on top of this I have to freeze the keyboard input and simulate a trigger press to reload) that I'm going to have to hard-code some functions for them... which sucks because I wanted to keep things as generic as possible. 


**update**

I remembered that hotd and vcop2 have more similar hardware than the original vcop, so I looked and sure enough, the addresses for hotd work for vcop2 as well! 

So now all that's left is the annoying Behind Enemy Lines...  AGAIN
I'm actually busy this week so I'm not sure how much I'll get done.  I just worked on it a little tonight to make sure my original idea for reload wasn't a dead end.

Dude, I don't know how to find so much time to get this far? I come off call tomorrow, so maybe I'll have some time to look at whats left over the weekend.
Title: Re: Sega Model 2 Emulator Full Screen Shooter fix - RamjetM2Borderless - App
Post by: Howard_Casto on February 12, 2013, 09:17:44 pm
That'd be helpful, thanks. 

I looked at the original vcop and although it does use a different byte to actually write to the game, that first inverted byte is what gets passed to THAT byte.   So I can use the same code for all three lightgun games, which is awesome. 

Also I tried the keypress simulation method that is used for the pc games on model 2.... originally it hadn't worked, so I abandoned that idea but apparently it DOES work.  Maybe some bad code on my part initially?  It could have been a focus issue as well.  Unlike joystick input, m2 doesn't respond to keyboard input unless the window has focus. 

Well this simplifies things dramatically.  On all lightgun and analog gun games, P1 Button 1 is P1's fire button and P1 Button 2 is P2's fire button.  They are Z and X by default in M2 so I can probably remove most of my NOPs, which would have made it mandatory for me to handle all other keyboard input.  I just need to block the mouse, which I'm pretty sure I can do. 

Unfortunately BEL won't be effected by this as it's keyboard inputs aren't hooked up. 

So aside from it, which I'm pretty sure I'm going to have to write a convoluted custom function for, that should hopefully take care of the rest. 
Title: Re: Sega Model 2 Emulator Full Screen Shooter fix - RamjetM2Borderless - App
Post by: Howard_Casto on February 12, 2013, 10:36:04 pm
Oh, one more thing before I forget. 

Can anyone confirm this for me.

I was playing around the other day and figured out a rather round-about way to block mouse input.  If I turn on raw input and have two mice hooked up I have to configure the mice to id #0 and id#2  id#1 doesn't do anything as as a consequence if I assign both players to id#1, I get two blocked mice. 

Now if I assign them to a crazy high number (I tried 8 and 9) it doesn't work, it blocks keyboard input as well.  I actually had to restart my pc on that little adventure. 


So I'm thinking the cleanest route might be to assign the mouse to an empty space and only use the reload code I found before. 
Title: Re: Sega Model 2 Emulator Full Screen Shooter fix - RamjetM2Borderless - App
Post by: vandale on February 13, 2013, 06:14:40 am
Oh, one more thing before I forget. 

Can anyone confirm this for me.

I was playing around the other day and figured out a rather round-about way to block mouse input.  If I turn on raw input and have two mice hooked up I have to configure the mice to id #0 and id#2  id#1 doesn't do anything as as a consequence if I assign both players to id#1, I get two blocked mice. 

Now if I assign them to a crazy high number (I tried 8 and 9) it doesn't work, it blocks keyboard input as well.  I actually had to restart my pc on that little adventure. 


So I'm thinking the cleanest route might be to assign the mouse to an empty space and only use the reload code I found before.

Doesnt it depend on what ID has been assigned to each device in windows meaning it can vary from PC to PC, ie my mac is 1 and 4 but my pc is 1 and 3.

Title: Re: Sega Model 2 Emulator Full Screen Shooter fix - RamjetM2Borderless - App
Post by: isamu on February 13, 2013, 06:26:43 am
Howard just to clarify, is this El Semi's Model 2 Emulator you guys are referring to? If so, do you have the source code for it? If so does that mean we could possibly see further improvements to the emu?

One bug in particular I'd like to point out is the emu crashing when you have more than 3 USB devices connected to your PC and you enter the controls config menu. As soon as you click on any of the analog settings the emu crashes.
Title: Re: Sega Model 2 Emulator Full Screen Shooter fix - RamjetM2Borderless - App
Post by: Howard_Casto on February 13, 2013, 06:38:50 am
vandale:  Most likely.  Don't compare Macs and Pcs though... Macs are wierd.  ;)

isamu:  Yes that's what we are referring to, but I do NOT have the source code.  If I did I could have added these additions in like an hour. 


Anyway, I woke up eraly this morning (bah! I need to sleep!) and thought I would implement my mice enumeration function for that little rawmouse app I posted a week or so ago.  The good news is the enumeration numbers of the mice are in the same order as model2 detects them!  With that knowledge in mind here is the revised plan of attack for the lightgun games:

1.  You setup in the troubleshooter if you'll be using mice (or lightgun's that show up as mice) or joysticks.

2.  If you are using joysticks, prior to m2 launching, the ts writes to the emulator.ini and sets rawinput to 0, if you are using mice, it sets rawinput to 1 and sets the RawDeviceP1 and P2 in the ini to the devices you have defined in the troublshooter. 

3.  Instead of ts getting launched automatically via lua scripts, we do it the other way around, ts now launches m2. 

So basically what will happen in lamens terms is if you are using a joystick device, I'll use my reload NOPs and you'll map your joystick buttons of choice in Model2.  If you are using mice, I won't use any code, instead just letting m2 read the mice buttons as normal.  In either case I'll block out the axis movement and handle it myself. 

In other words, it's merely the axis movement in m2 that's broken, so instead of pulling my hair out trying to include triggers as well, why not just let m2 handle them normally?  The only catch will be that you can't mix and match devices.  You can use either mice-based devices or joystick ones, not one of each.

This will cover every game but bel, and honestly I've accepted the fact that it will need a convoluted custom function anyway.  Also it was mentioned in another thread that Virtua ON has screwed up controls.  It will take another custom function, but if it's fixable I'll do that one as well. 
Title: Re: Sega Model 2 Emulator Full Screen Shooter fix - RamjetM2Borderless - App
Post by: mike boss on February 13, 2013, 07:39:46 am
Keep up the awesome work guys.
I look forward to getting the completed project installed.

Title: Re: Sega Model 2 Emulator Full Screen Shooter fix - RamjetM2Borderless - App
Post by: Howard_Casto on February 13, 2013, 09:06:57 am
I gotta go in a few minutes, but I thought I would fire up Virtua ON and look at my cheat engine file with it running to try and track down the problem. 

Seems to be a coding error... there are two banks for the inputs on the game, one for the left stick in the usual place, and another for the right one byte over.  There's an error where only one bank can be written to at a time, thus why both sticks can't be pressed together.  It might be fixed via new code so somebody more talented than me might want to check it out. 

The area in memory (on multi cpu) is 58f91e for the right stick's bank, and 58f91d for the left (which also houses stuff like the coin/start/and menu buttons).  A single NOP located at +B75CF disables both.

When I NOP the location mentioned and manually adjust the banks I CAN get both sticks to work at the same time, so regardless of the approach it is fixable. 
Title: Re: Sega Model 2 Emulator Full Screen Shooter fix - RamjetM2Borderless - App
Post by: Howard_Casto on February 14, 2013, 12:52:30 am
Worked a little more on things tonight. 

Gunblade is my goto test game, so I tried the new theory about simply letting m2 handle the inputs.  Seems to work fine.  What I did was revert the inputs in m2 to their default,  Z for p1 button 1 and X for p1 Button 2 (which is actually p2 button 1 in the gun games) I then used the troubleshooter in joystick mode and assigned the triggers on that end to the first button of the joystick.  When running, troubleshooter just simulates pressing the Z key and that works just fine.  I then went on to try the game in mouse mode.  Now TS still sends the Z key, but it doesn't interfere with the pressing of the mouse buttons, so no need for a special case. 

Anyway, I'll keep working on it. 

Also somewhere along the line, my NOPs for rail chase 2 got screwed up....  It probably happened when I was trying to get BEL working as I kept copying and pasting back and forth in the ini files to try different addresses.  It's fixable, but that's annoying because now I'll have to go back and try them all again, which will take the better part of an afternoon. 

So hopefully if I spend this weekend getting my ducks in a row with the ini files and writing the special reload function for the lightgun games, I'll be ready at least for an alpha release, soon. 
Title: Re: Sega Model 2 Emulator Full Screen Shooter fix - RamjetM2Borderless - App
Post by: Howard_Casto on February 14, 2013, 02:42:52 am
Thought I'd take a little break from the m2 end of things again and do some finishing touches on the pc games. 

Installed a pc version of VCop (which sucks) and played around with it to get the double reload function working. 

I honestly don't have a clue why it's setup that way. 


I want to go back to the pc stuff later on and make sure all menus are usable via the gun buttons, but for now, vcop was the last special case thing I had to deal with. 
Title: Re: Sega Model 2 Emulator Full Screen Shooter fix - RamjetM2Borderless - App
Post by: RamjetR on February 14, 2013, 05:04:27 am


Gunblade is my goto test game, so I tried the new theory about simply letting m2 handle the inputs.  Seems to work fine.  What I did was revert the inputs in m2 to their default,  Z for p1 button 1 and X for p1 Button 2 (which is actually p2 button 1 in the gun games) I then used the troubleshooter in joystick mode and assigned the triggers on that end to the first button of the joystick.  When running, troubleshooter just simulates pressing the Z key and that works just fine.  I then went on to try the game in mouse mode.  Now TS still sends the Z key, but it doesn't interfere with the pressing of the mouse buttons, so no need for a special case. 


Wicked... I had a good hunch that the keyboard binds would work... I was suprised when you initially said it didn't... There is so much nopping going on, it wouldn't take much to leave some test nops in and get false results... glad you decided to revisit it.


Title: Re: Sega Model 2 Emulator Full Screen Shooter fix - RamjetM2Borderless - App
Post by: Howard_Casto on February 14, 2013, 05:14:56 am
Yeah it sure has simplified things.  Now if I could get that stupid Behind Enemy Lines to play ball.  The poor game must have been hacked to hell to get it running, because it seems like every function on it is a special case. 

Ok more good news to report.  I added a new "reload mode" option in the ini files.  If set to "VCOP" it does the double reload trick for the pc version, if set to "M2L" (model 2 lightgun) it checks to see if you are using joysticks and installs two NOPs for the reload button and installs the trigger keys if you are.  Tried it with m2's VCop and it works flawlessly for both players.  So FINALLY a fully working lightgun game.  The reload method is universal as well, so it will work, without modification for hotd and vcop2. 

If Set to "MLA"  (model 2 Analog) it will only install the key hooks as those are all that's needed for gunblade and rail chase. 

I'm off to modify hotd and vcop2 ini files to make sure it works.  Expect an update in about 5 minutes.  ;)

Title: Re: Sega Model 2 Emulator Full Screen Shooter fix - RamjetM2Borderless - App
Post by: Howard_Casto on February 14, 2013, 05:40:37 am
Yeah the new reload code works for the other two games as well. 

Apparently I've forgotten to do the NOPs for the axis in vcop 2 though, so I'll have to fix those. 

So to update:

gunblade 100%
rail chase 2 100%
vcop 100%
vcop 2  needs axis fixed
hotd 100%
bel  needs triggers fixed
Title: AW: Sega Model 2 Emulator Full Screen Shooter fix - RamjetM2Borderless - App
Post by: Endprodukt on February 14, 2013, 07:34:38 am
Awesome, almost there. Will you release the ts when the guns are fully supported or will you implemented fixes for the outputs first? Thank you so much,again!
Title: Re: Sega Model 2 Emulator Full Screen Shooter fix - RamjetM2Borderless - App
Post by: Howard_Casto on February 14, 2013, 08:30:42 am
I'm not sure to be honest. 

I've got most of the outputs at least partially figured out, so most games have a output section, they just aren't necessarily working 100%.  I would hate to release it and then find out that one game's output requires a custom function, but then again, I need it out there pretty soon so people can test it. 
Title: Re: Sega Model 2 Emulator Full Screen Shooter fix - RamjetM2Borderless - App
Post by: Howard_Casto on February 14, 2013, 08:34:47 am
I went ahead and spent the morning finding the axis for vcop 2.... I haven't plugged them in yet, but there are working in the cheat engine, so we might as well check vcop 2 off the list


now it's just bel and gunblade (that was an error in my last progress report, it's axis are hosed as well). 
Title: Re: Sega Model 2 Emulator Full Screen Shooter fix - RamjetM2Borderless - App
Post by: BadMouth on February 14, 2013, 09:43:08 am
I'm not sure to be honest. 

I've got most of the outputs at least partially figured out, so most games have a output section, they just aren't necessarily working 100%.  I would hate to release it and then find out that one game's output requires a custom function, but then again, I need it out there pretty soon so people can test it.

Not that it isn't worth doing, but 99% of the users aren't going to utilize the outputs anyway.
IMO, get everything else working perfectly for the first release, then focus outputs for the next release.
Just my $.02
Title: Re: Sega Model 2 Emulator Full Screen Shooter fix - RamjetM2Borderless - App
Post by: Endprodukt on February 14, 2013, 12:47:40 pm
Just my thought. This way we can test everything lightgun related on our systems and report if something is not working while you can focus on the outputs!
Title: Re: Sega Model 2 Emulator Full Screen Shooter fix - RamjetM2Borderless - App
Post by: yakk11 on February 14, 2013, 06:48:59 pm
Hey guys, thanks for all of your hard work! 

I have installed this application in the folders needed, but am not able to do an off screen reload.  When i minimize the emulator, I can see the icon of the game in the taskbar.  Am I missing something?  I'm using an Aimtrak...

Can't wait for the 2 player hack!   :applaud:
Title: Re: Sega Model 2 Emulator Full Screen Shooter fix - RamjetM2Borderless - App
Post by: Howard_Casto on February 14, 2013, 07:44:14 pm
You'd have to ask ramjet... the osr app is his. 

Ok I got rail chase fixed, so that just leaves bel. 

Also a note to myself, I need to re-calculate the single cpu addresses to vcop2. 


So that just leaves VON, which isn't terribly complicated, I just need to write a custom function, and BEL, which well I'm about to hunt down the people that made this game and strangle them in their sleep. 
Title: Re: Sega Model 2 Emulator Full Screen Shooter fix - RamjetM2Borderless - App
Post by: RamjetR on February 14, 2013, 09:00:21 pm
Hey guys, thanks for all of your hard work! 

I have installed this application in the folders needed, but am not able to do an off screen reload.  When i minimize the emulator, I can see the icon of the game in the taskbar.  Am I missing something?  I'm using an Aimtrak...

Can't wait for the 2 player hack!   :applaud:

Hi,

So long as you downloaded it as a ZIP (from the File>Download selection on the page from google) and extracted it into the main folder. Then all the scripts and logo's should have gone into the right places on their own.

If the Icon show's the correct game when you've launched the emulator then it should have worked. Does it remove the min,max,close buttons around the screen? if so then it has done it's job.

I don't know if the reload function only worked when it is fullscreen? can anyone confirm this with a lightgun? I had some people in the forum test this for me as I don't have one or two of them yet. Oh perhaps check your aimtrak settings? isn't there an off screen reload funtion in their software? like a Right Click or something?

I'm considering a better file hosting. Google drive is good, but alot of people seem to miss the download button to get the whole zip as they think it's just files?
Title: Re: Sega Model 2 Emulator Full Screen Shooter fix - RamjetM2Borderless - App
Post by: BadMouth on February 14, 2013, 10:05:42 pm
We've hijacked RamjetR's thread, but it's way to late to start a new one.  All the info is here.  :lol

Didn't see anyone else working on a logo for Troubleshooter 2 and felt like giving it a try.
The site I got the gun from says everything is public domain (even though it's user uploaded).
This is a first draft.  I should probably do something different with the 2.

Thoughts?

EDIT: added another version
double edit....slightly tweaked 2nd one to center things better
Title: Re: Sega Model 2 Emulator Full Screen Shooter fix - RamjetM2Borderless - App
Post by: Howard_Casto on February 14, 2013, 10:58:12 pm
I really like the second one. 

Maybe a faux chrome effect on the text to make it look cheesier, but I'd say that's perfect. 

Once I release this thing I'll start a new thread.  We've ruined this one.  ;)

Except for those last two games it's mostly cleanup work at this point.  The user configuration menu is still non-existant, but it's gotten simplier as we've went on, so it was best to wait until last. 

I'm honestly not sure if we'll have a release this weekend or not.  I keep getting burnt out working on this, but I can't stand it when I've got an unfinished puzzle lying around, so I keep coming back to it. 

I"m going to go ahead and fix the addresses for vcop 2 before I forget about it, but I think that's it for today. 
Title: Re: Sega Model 2 Emulator Full Screen Shooter fix - RamjetM2Borderless - App
Post by: BadMouth on February 15, 2013, 12:07:21 am
It's a bit harder to read with the 90's style fake chrome.
The one in the first post is a slight gradient.
Maybe I can make it shinier somehow.

This is the extent of my ability to make fake chrome unless I find time to follow a tutorial.
I will gladly turn it over to someone who already has the skills.

Done for now. I need sleep.
Title: Re: Sega Model 2 Emulator Full Screen Shooter fix - RamjetM2Borderless - App
Post by: RamjetR on February 15, 2013, 03:42:25 am
We've hijacked RamjetR's thread, but it's way to late to start a new one.  All the info is here.  :lol

I haven't minded... we've all had good input into it. Howard fortunately has a lot more windows programming skills and experience than I do. There was little point me pushing my program as without each others help, this would have taken alot longer. He deserves a name in the hall of fame of Arcadecontrols.com for his efforts to the community. :)

It's only a little over a year since I release the RamjetVR program which has till now been only Pacdrive compatible because I didn't have anything else to test with... and that was pretty much the start of a movement for Model 2 again. Everything I've done has been for the first time and pretty much winging it from electronic experience of past.

I don't think this would have happened had the issue with M2 losing screen focus on reload was not solved, and then suddenly it seemed viable to put effort into fixing what was left.

Darthmarino's video was confirmation that Model 2 shooters looked exciting to play when he first posted the test video with the borderless app. So it's really been a community pulling together. I'm really glad to have been part of it and to share what we've done.

I love the Logo too! It's almost fitting to the time that the program now serves :)
Title: Re: Sega Model 2 Emulator Full Screen Shooter fix - RamjetM2Borderless - App
Post by: Howard_Casto on February 15, 2013, 04:59:05 am
Well for me, the thing with model2 is I never expected that after all these years it would still be the ONLY way to play these games.  When it came out I remember thinking "this is great, but it'll get better once these games are in mame."  Fast forward several years later and Mame can barely boot some of them.  At the time the pc ports of these games were a viable option as well.  Now, as I've unfortunately experienced during testing, some of the older titles particularly the original hotd and vcop, barely install on a modern pc. 

I had just been playing around with the idea of wiimotes as a gun when I stumbled upon this thread.  So the timing was right.  Things tend to go along faster when it's a group helping each other along.  Go over and look at the old controls.dat site for proof of that.  You'd think that all of those pain-staking-ly tedious entries would have been done by a massive team, but nope... just me and two other guys for the most part.  ;)


In regards to the logo.... what software are you using?  I've got a small collection of filters in photoshop we can try if you want to keep tweaking it.  I like the layout, I like the colors, it's well done.  We just need to get that flat look off of it so that the text feels in front of the guns and not against them. 

But I "demand" a stupid tag line.  We need just list a bunch and decide which one is funniest. 

I'll start us off.

Troubleshooter 2:  Shoot Harder

Troubleshooter 2:  Reloaded

Troubleshooter 2:  This time, it's personal

Troubleshooter 2:  Judgement Day  ;)

Troubleshooter 2:  Electric Boogaloo   (Damn I've got to use that for one of my apps eventually.  ;)  )


Aaaaanyway.  It's a new morning so I think I'm going to work on the app a little.  I'll leave the games for later.  Right now I'm going to start hooking up the configuration page. 
Title: AW: Sega Model 2 Emulator Full Screen Shooter fix - RamjetM2Borderless - App
Post by: Endprodukt on February 15, 2013, 05:15:52 am
Judgement day made me crack up!!
Title: Re: Sega Model 2 Emulator Full Screen Shooter fix - RamjetM2Borderless - App
Post by: Howard_Casto on February 15, 2013, 07:14:39 am
Well I got the configuration menu to load nearly all of the user-configurable ini settings.  Upon hooking it up I realized that a few options need re-organized, but it's no big deal.

Then I just do the whole thing in reverse for saving.  ;)
Title: Re: Sega Model 2 Emulator Full Screen Shooter fix - RamjetM2Borderless - App
Post by: DarthMarino on February 15, 2013, 07:34:45 am
(http://img.photobucket.com/albums/v489/mmarino/LTIBS_zpsc214628f.jpg)
Title: Re: Sega Model 2 Emulator Full Screen Shooter fix - RamjetM2Borderless - App
Post by: Howard_Casto on February 15, 2013, 08:09:19 am
:D
Title: Re: Sega Model 2 Emulator Full Screen Shooter fix - RamjetM2Borderless - App
Post by: Howard_Casto on February 15, 2013, 09:05:10 am
I took a minute this morning to implement something that I thought might be useful. 

I've mentioned before that native joystick support in a lot of the pc games (or emulators for that matter) sucks.  One of the reasons the the fact that most of them default to passive polling, meaning that gamepad data only gets updated if the joystick sends a message to the program.  Why is this a problem?  Well many older joysticks or joysticks with unsigned drivers require active polling.  Plug a classic xbox controller in to see how many games are playable and you'll see what I mean. 

HOTD3, again, the only pc game I care about at this point, doesn't support active polling. 

So optionally you can now turn on active polling, which fixes a lot of joystick issues. 
Title: Re: Sega Model 2 Emulator Full Screen Shooter fix - RamjetM2Borderless - App
Post by: Howard_Casto on February 15, 2013, 09:16:17 am
Another idea that's been floating around in my head. 

There's that menu problem in the pc games and I'm trying to think of good solutions. 

One idea that I thought of was having hot key zones.  If you move the lightgun to the absolute bottom of the screen and leave it there for a second, the "down" key will be pressed once, if you hold it to the top, the up key will be pressed ect...  Now for real lightguns "holding" would mean simply firing in that area.  Pressing the fire button or reload button, in either instance, cancels the hold. This would work well for hotd3's map selection. 

I had initially thought that I fixed the problem when emulating the system mouse, but apparently the cursor doesn't pop up in keyboard mode for selection (didn't play that far). 

I would like some feedback on this idea.  I know it has the potential to interfere with gameplay, but I don't think there are many games where you fire at the extreme edges of the screen repeatedly. 
Title: Re: Sega Model 2 Emulator Full Screen Shooter fix - RamjetM2Borderless - App
Post by: BadMouth on February 15, 2013, 09:35:54 am
Another idea that's been floating around in my head. 

There's that menu problem in the pc games and I'm trying to think of good solutions. 

One idea that I thought of was having hot key zones.  If you move the lightgun to the absolute bottom of the screen and leave it there for a second, the "down" key will be pressed once, if you hold it to the top, the up key will be pressed ect...  Now for real lightguns "holding" would mean simply firing in that area.  Pressing the fire button or reload button, in either instance, cancels the hold. This would work well for hotd3's map selection. 

I had initially thought that I fixed the problem when emulating the system mouse, but apparently the cursor doesn't pop up in keyboard mode for selection (didn't play that far). 

I would like some feedback on this idea.  I know it has the potential to interfere with gameplay, but I don't think there are many games where you fire at the extreme edges of the screen repeatedly.

meh, sounds like unecessary bloat.  Most people are going to have a full CP in front of them.
Even on the original light gun cabs, you had to reach to the cab for the start button.

I played vcop all the way through last night for the first time and had reload issues during the second two boss shootouts.
I was trying to keep the gun on-screen and reload with a button (right mouse click).
The game would keep yelling at me to reload and I would keep hitting the button, but it was as if the emulator was overwhelmed and the reload wouldn't register until the third or fourth try.  This was v.9 on a 2.9ghz Athlon X3.  I imagine it will be worse with 2 players. 
Figured I'd mention it in case someone reports it as an issue with your app when it is really an issue with the emulator.
EDIT: guess it's also possible that I was pulling the trigger at the same time I was trying to reload.  It seemed to work better if actually shooting offscreen, at which point I probably wasn't hitting both buttons.

On the logo:
If someone else wants to have a go at it:
Here is the original picture I started with: http://www.clker.com/cliparts/9/3/1/3/1194989450326225818blue_gun_alex_fernandez_01.svg.hi.png (http://www.clker.com/cliparts/9/3/1/3/1194989450326225818blue_gun_alex_fernandez_01.svg.hi.png)
I recolored it to get the red one.
The troubleshooter font is DENISE

I may or may not have time to tinker with it this evening. 
Depends on how much later I have to work to make up for screwing around on BYOAC.


Title: Re: Sega Model 2 Emulator Full Screen Shooter fix - RamjetM2Borderless - App
Post by: Howard_Casto on February 15, 2013, 10:22:54 am
Well the problem though is people aren't using lightguns anymore... they are using ir guns. 

Those things have to be recalibrated every time you move around.  I've already added the option of having your start/coin/esc buttons on the gun (in other words mapped to mouse or joystick buttons) to help combat this issue. 

It doesn't suprise me that you had trouble reloading.  Mouse support in the emulator, with all due respect, seems kind of hacked in.  If you hold down a mouse button in the emulator and then look at the value in a memory editor, you can see it constnatly being set back to off.  My memory injection doesn't do this, so it's slightly more reliable, but that only pertains to joystick input. 
Title: Re: Sega Model 2 Emulator Full Screen Shooter fix - RamjetM2Borderless - App
Post by: Endprodukt on February 15, 2013, 10:40:10 am
That's why I requested an on the fly calibration setup from ultimarc, Andy said he would support - though he has no time to do it himself. Idea was to get a screen popup before the game launches. Player 1/2 would have to calibrate the gun on the fly on a target (shoot upper left, shoot upper right etc). That would only work for the aimtraks though. It sucks that whenever someone else is playing the calibration is possibly a little off due to the ir guns beeing so sensitive to their actual position.
Title: Re: Sega Model 2 Emulator Full Screen Shooter fix - RamjetM2Borderless - App
Post by: Howard_Casto on February 15, 2013, 12:04:52 pm
That's why I requested an on the fly calibration setup from ultimarc, Andy said he would support - though he has no time to do it himself. Idea was to get a screen popup before the game launches. Player 1/2 would have to calibrate the gun on the fly on a target (shoot upper left, shoot upper right etc). That would only work for the aimtraks though. It sucks that whenever someone else is playing the calibration is possibly a little off due to the ir guns beeing so sensitive to their actual position.

My wiimote scripts do this as well.  You press up on the d-pad and it prompts you to shoot the corners.  The old act-labs guns support this as well.  I honestly am suprised to learn that the aim tracks don't have this feature... it's butt easy to implement, although with "real" guns  like the aimtrack, it has to be done at the hardware level. 
Title: AW: Sega Model 2 Emulator Full Screen Shooter fix - RamjetM2Borderless - App
Post by: Endprodukt on February 15, 2013, 12:57:53 pm
Well there is an configuration tool. You can setup the aimtrak to start the setup by holding the there for 5-60 seconds. This leads to problems with games that require you to hold down the trigger like terminator. What I hoped for was something more like a prompt that everyone who's standing on the cabinet understands immediately. No hidden setup. A small guide that's launching the game after configuration.
Title: Re: Sega Model 2 Emulator Full Screen Shooter fix - RamjetM2Borderless - App
Post by: helltraum on February 15, 2013, 03:05:51 pm
Hi all,

I've been following this thread for a while but have only just registered on the forum, the work that you guys have done and are in the progress of doing inspired me to purchase 2 AimTrak guns with recoil    ;D.  So I thought it was about time to register and get involved.

If you look in the AimTrak configuration software you can disable the 5 second configuration on the trigger and set it to one of the left or right red buttons on the AimTrak and also set it to apply either when the gun is pointing at the screen or when it's off screen, this would solve the problem for games where you have to hold down the trigger.  The red buttons by default are set to game pad buttons for the AimTrak device, button 1 for the left button and button 2 for the right button, I was just wondering if these buttons could be used via the new Troubleshooter for menu navigation / selection on PC Games and for coin / start M2 games?
Title: AW: Sega Model 2 Emulator Full Screen Shooter fix - RamjetM2Borderless - App
Post by: Endprodukt on February 15, 2013, 03:35:54 pm
Wouldn't solve the problem with the invisible setup and people who don't know about this. Also, I hacked up namco guns from the arcade so... No second button :)
Title: Re: Sega Model 2 Emulator Full Screen Shooter fix - RamjetM2Borderless - App
Post by: RamjetR on February 15, 2013, 06:52:43 pm
So I'm in the market for some lightguns now too... whats the recommendations?

Aimtraks? Top Guns? Really want recoil as a feature... not worried about laser pointers.
Title: Re: Sega Model 2 Emulator Full Screen Shooter fix - RamjetM2Borderless - App
Post by: helltraum on February 15, 2013, 08:17:50 pm
Well I've just got my AimTraks (with recoil) and I think they're brilliant, they're really easy to setup and calibrate and they see pretty accurate in games, much more than my experience with using Wii motes or Playstation Move.
Title: Re: Sega Model 2 Emulator Full Screen Shooter fix - RamjetM2Borderless - App
Post by: Howard_Casto on February 15, 2013, 11:25:49 pm
Well the problem about the aimtrack recoil method is it's fake.  I talked to andy a couple of years ago about making the recoil bit writeable, so mamehooker can send the game-controlled signals, but I don't think anything ever came of it.  Seriously MH can do raw HID writes.... all I need is an address and some data to send. 
Title: Re: Sega Model 2 Emulator Full Screen Shooter fix - RamjetM2Borderless - App
Post by: Howard_Casto on February 15, 2013, 11:40:56 pm
Sorry, didn't finish my thought (gold rush is on) right now I'm looking for a good shell.  There are these generic wiimotes (cheap chineese knock-offs) you can get, with nunchuck for around 4 dollars.  I've tried them and the only snag is they don't work right with glovepie unless a nunchuck is installed.  That's actually ok for me because I wanted to be able to plug in a foot padel anyway for soem of those oddball sega shooters. 

So the plan is to hack one of these up a little.  I wanted to use the triggers from the nunchuck and put them inside a shell, hack the rumble and make it to where I could change out shells (maybe a machine gun shell with a fiercer ff for the analog gun games, and a small pistol version for the others). 

I wouldn't nearly be as seamless as an aimtrack, we still have bluetooth issues, but 4 dollars+shell as opposed to 50 dollars +shell.  ;)
Title: Re: Sega Model 2 Emulator Full Screen Shooter fix - RamjetM2Borderless - App
Post by: Howard_Casto on February 16, 2013, 04:41:25 am
Ok I got the Virtual On Hack in place and it appears to work.  I can jump now at least.  ;)  It still needs some finishing work.  Right now only keyboard inputs are hooked up, I want to optionally allow for joysticks.  Since it's possible that the user could use a single, two axis joystick, or two seperate joysticks, it will require a bit of special code. 

Anyway, while working on that, I stumbled upon an idea to fix Behind Enemy Lines.  You see each m2 game has three banks for the inputs, one for the start/coin/ect, one for p1's controls and another for p2.  If I NOP any part of the mice input, it crashes m2, so that flat out won't work.  It's one of the reasons getting reload to work was so tiring... reload is a mouse only input.  But I started thinking... the gun games only use the player one bank for the triggers... player 2 just sits there.  So I took the assembly code that reads bank1 and modified the pointer to read bank 2 instead.  BAM!  Truely redefinable trigger/reload inputs! 

Now they show up a little wonky in M2:
M2 Description:     Actual Input:
P2 Button 1          P1 Trigger
P2 Button 2          P2 Trigger
P2 Down              P1 Reload/trigger 2
P2 Up                  P2 Reload/trigger 2

The import thing though is that they work.  That essentially fixes BEL!

I'll have to write a special function though... as of now only NOPs are supported, I'll have the add the option in the NOP section to change each byte into a specific value.

I had thought about re-directing the memory space when ramjet suggested it, but sharing a space across two apps is potentially dangerous.  If one of them screws up it could lead to a BSOD... or at least it could in Xp systems.  But since I'm using an existing memory space within M2, it is much safer and I feel, doable. 

Not only that but this trick should work for all the other lightgun/gun games as well.  So no more fighting m2's mouse code or jerry-rigging the triggers, I can handle the whole she-bang on my end. 


So yeah, I'm going to have to implement this function and change things a bit, it's going to take a few more days... but it should be well worth the wait.
Title: Re: Sega Model 2 Emulator Full Screen Shooter fix - RamjetM2Borderless - App
Post by: Howard_Casto on February 16, 2013, 05:27:04 am
*Update*

Implemented a very simple "replace" option in the NOP section of the INI files.  Added this little bit of code to bels ini file and it indeed fixed the triggers!  I'll try it on the other gun games tomorrow. 

I'm not sure how I feel about this.... I had intentially made the memory editing portion of the ini files NOP only.  The reason being if you give people the ability to not only disable code, but also alter it, you've essentially built a cheat engine.  I'm not against cheat engines or cheat codes.. so long as everyone is in on it.  Online cheating is a pita though and I don't endorse it.  Hopefully people will use this "feature" responsibly. 
Title: Re: Sega Model 2 Emulator Full Screen Shooter fix - RamjetM2Borderless - App
Post by: Howard_Casto on February 16, 2013, 08:01:22 am
*Update 2*

The true lightgun games require a couple more NOPs, but moving the input section over the 2p bank indeed works for them as well! 

This will make configuration of Model2 even easier for the user as it will require no special settings or the use of m2's rawmouse options. 

What I will do is include to pre-configured cfg files for the lightgun/gun games to place in the m2 folder for key remapping.  The user won't even have to touch them unless they wish to change the mapping of the start/coin buttons. 
Title: Re: Sega Model 2 Emulator Full Screen Shooter fix - RamjetM2Borderless - App
Post by: Howard_Casto on February 16, 2013, 09:27:09 pm
Well now that all of the games are figured out, I guess it's time to actually get the thing functional. 

Worked on the raw mouse button code this evening.  I really get the feeling that the "raw data" format was made without multi-button mice in mind.  The windows message system sends a power of 2 value if a button is down, or twice that value if it is released. 

So Button 1 down is 1 and button 1 up is 2.  Button 2 down is 4 and button 2 up is 8. 

Not so bad right?  Well if we were still in the 3 button mouse days no, but today a mouse can have up to 16 buttons! 

So button 16 down is 1073741824 and button 16 up is 214783648!!!!! 

That's a lot of data to send though the pipe. 

Anyway, I wrote a little function to define the power of 2 constants and compare the messages... converting everything into a nice array with the state of each button. As of now, all of my rawmouse code is in that little test app I sent out.  I'll transfer the whole thing over once I've gotten it completed which should be very soon. 
Title: Re: Sega Model 2 Emulator Full Screen Shooter fix - RamjetM2Borderless - App
Post by: vandale on February 17, 2013, 04:00:17 am
Well I've just got my AimTraks (with recoil) and I think they're brilliant, they're really easy to setup and calibrate and they see pretty accurate in games, much more than my experience with using Wii motes or Playstation Move.

Hi, regarding the wiimotes.

I use 2 wiimotes hacked into Guncon 2 shells with 3.3v hardwired which means no disconnect due to flat batteries, combined with a good bluetooth chipset and Howards wiimote scripts, I couldnt ask for anything better.

Connects via the guncon side buttons, calibrates via the guncon d pad, never disconnects, works in MAME and Model 3, and soon Model 2  ;)

Pics of  wiimote/guncon2 mashup:
(http://s1.postimage.org/n5eg5u6rf/wiimote_to_gun2.jpg) (http://postimage.org/image/n5eg5u6rf/)
(http://s14.postimage.org/6gsruu7d9/wiimote_to_gun1.jpg) (http://postimage.org/image/6gsruu7d9/)
(http://s2.postimage.org/4a46tlio5/wiimote_to_gun3.jpg) (http://postimage.org/image/4a46tlio5/)
Title: Re: Sega Model 2 Emulator Full Screen Shooter fix - RamjetM2Borderless - App
Post by: Howard_Casto on February 17, 2013, 08:14:07 am
Yeah I think a lot of people have only messed with wiimotes/move via the game consoles and are judging their experiences on that. 

This isn't a fair comparison because the home consoles do NOT treat these devices like a lightgun, they just throw a cursor on the screen.  IR gun accuracy is all about the software... we could probably even push accuracy even further with a custom ir led array and better software.  That goes for the aimtrack as well. 


Nice setup btw.  I've been thinking about doing the same thing, only slightly different.  I want to put rechargable batteries in the wiimote guns, but use a telephone cable as a power receptacle.  The phone cable (or perhaps cat5) would pass 5v for charging and 24v for a recoil solenoid.  I could unplug it and go wireless whenever I want, I'd just lose the recoil. 
Title: Re: Sega Model 2 Emulator Full Screen Shooter fix - RamjetM2Borderless - App
Post by: helltraum on February 17, 2013, 10:12:34 am
I wrote a simple GlovePIE script for my Wiimote linked to the mouse, it was OK but the accuracy was a little temperamental at times, I'd be interested in giving Howard's scripts a try, where can I get them?
Title: Re: Sega Model 2 Emulator Full Screen Shooter fix - RamjetM2Borderless - App
Post by: Howard_Casto on February 17, 2013, 10:16:15 am
Man this rapidly chaning weather sucks!  It's like 17 degrees here. 

Anyway, that means I'm stuck inside today.  I applied the much cleaner bel nops to vcop 2 so I could make sure it works universally.  Fortunately it does!  This makes my code a heck of a lot cleaner.  All that remains of the custom functions I had to add in for m2 is a tiny little bit of code that resets the reload bit for the lightgun games.  It's 4 lines long, so I can live with that.  ;)

Last time I borked up some of my ini files because I was working too fast.  I'm not going to do this today.  I did vcop2, just now... I'll do the rest throughout the day as I feel like it.  I need to take the time to test each ini as I complete it to make sure it is working properly. 

So every game is 100% at this point, but I do need to update the inis to the cleaner code, as I just mentioned. 


The scripts are on this board, just search for glovepie. 
Title: Re: Sega Model 2 Emulator Full Screen Shooter fix - RamjetM2Borderless - App
Post by: Howard_Casto on February 17, 2013, 05:12:37 pm
Ok so alll the M2 games work now.  I've still got to write a function for joystick support for von, but other than that. 

Still lots of little stuff and cleanup work to do.  I'm going to tenatively say it'll be ready next week, unless we run across some crazy issue again. 
Title: Re: Sega Model 2 Emulator Full Screen Shooter fix - RamjetM2Borderless - App
Post by: Endprodukt on February 17, 2013, 05:22:49 pm
Awesome!!!! Lightgun-Party at my place ahead!
Title: Sega Model 2 Emulator Full Screen Shooter fix - RamjetM2Borderless - App
Post by: TIGER8855 on February 17, 2013, 05:47:49 pm
Ok so alll the M2 games work now.  I've still got to write a function for joystick support for von, but other than that. 

Still lots of little stuff and cleanup work to do.  I'm going to tenatively say it'll be ready next week, unless we run across some crazy issue again.

Awesome! Great work.

Are you still planning to include M2 output support for the VR buttons and race leader lamps in this release?
Title: Re: Sega Model 2 Emulator Full Screen Shooter fix - RamjetM2Borderless - App
Post by: BadMouth on February 17, 2013, 06:22:33 pm
Logo attached with room for tag line added.
Probably need to fine tune the alignment, but thoughts on it?
Did we decide on a tag line?

Troubleshooter 2 - The Wrath of Casto
Troubleshooter 2 - The Search For El Semi
Title: Re: Sega Model 2 Emulator Full Screen Shooter fix - RamjetM2Borderless - App
Post by: RamjetR on February 17, 2013, 08:08:03 pm
How about Troubleshooter 2 - Double Trouble!

?
Title: Re: Sega Model 2 Emulator Full Screen Shooter fix - RamjetM2Borderless - App
Post by: vandale on February 18, 2013, 02:31:42 am
Twice as much gun is my favourite
Title: Re: Sega Model 2 Emulator Full Screen Shooter fix - RamjetM2Borderless - App
Post by: Howard_Casto on February 18, 2013, 04:03:10 am
Ok so alll the M2 games work now.  I've still got to write a function for joystick support for von, but other than that. 

Still lots of little stuff and cleanup work to do.  I'm going to tenatively say it'll be ready next week, unless we run across some crazy issue again.

Awesome! Great work.

Are you still planning to include M2 output support for the VR buttons and race leader lamps in this release?

Yes, but keep in mind that outputs work by communicating to mamehooker.  So I'll have to release a new version of mamehooker before outputs will work. 
Title: Re: Sega Model 2 Emulator Full Screen Shooter fix - RamjetM2Borderless - App
Post by: Howard_Casto on February 18, 2013, 04:05:11 am
Logo attached with room for tag line added.
Probably need to fine tune the alignment, but thoughts on it?
Did we decide on a tag line?

Troubleshooter 2 - The Wrath of Casto
Troubleshooter 2 - The Search For El Semi

Heh..... I'm leaning towards shoot harder myself.  It makes absolutely no sense, like all the titles to the die hard sequels. 
Title: Re: Sega Model 2 Emulator Full Screen Shooter fix - RamjetM2Borderless - App
Post by: Howard_Casto on February 18, 2013, 06:49:36 am
RamJet... I've got a question for you. 

I never did find out where the cross hair data was stored, so I figured I would just draw them via LUA script.  Did we ever figure out how to read regions in memory outside of the emulator space?

Here was the code I was going to use (eventually weeding out the hardcoded values and using a image instead of a "+" text)
==============================================================================
XPOS = I960_ReadByte(0x58f7b4) / 255;
XPOS = XPOS * 1024;

YPOS = I960_ReadByte(0x58f7b6) / 255;
YPOS = YPOS * 768;

Video_DrawText(XPOS,YPOS,"+",0xFF0000)
==============================================================================

But the value of these memory addresses are static and whenever I try to read them, they come up as 0.  These are the addresses in artmoney though.  So if m2 supports reading outside the space it should be quite easy to get them. 
Title: Re: Sega Model 2 Emulator Full Screen Shooter fix - RamjetM2Borderless - App
Post by: Howard_Casto on February 18, 2013, 09:18:54 am
Well I would still like an answer to my question BUT I did manage to find some redundant addresses elsewhere for vcop and managed to draw some crosshairs. 

I'm just using a "+" now, but there are scripts in lua to load png images.  I see no reason why we couldn't implement a toggling system like mame uses.  Heck we can even use the same cross hairs. 
Title: Re: Sega Model 2 Emulator Full Screen Shooter fix - RamjetM2Borderless - App
Post by: Howard_Casto on February 18, 2013, 12:00:58 pm
I ran into a wierd issue and I need you guys to check something out for me. 

Go into Virtua Cop 2 in m2 and press f2 to get into the test menu.  Go to the input test.   Is p2's trigger stuck in the ON position?  If not I think my exe may be corrupted in some way. 
Title: Re: Sega Model 2 Emulator Full Screen Shooter fix - RamjetM2Borderless - App
Post by: Endprodukt on February 18, 2013, 12:50:06 pm
No it's not stuck on my system.
Title: Re: Sega Model 2 Emulator Full Screen Shooter fix - RamjetM2Borderless - App
Post by: DarthMarino on February 18, 2013, 01:03:08 pm
Not stuck on mine either.  I press the "X" key and it turns on.
Title: Re: Sega Model 2 Emulator Full Screen Shooter fix - RamjetM2Borderless - App
Post by: Howard_Casto on February 18, 2013, 01:12:17 pm
BAH!

Yeah I replaced the exes and they are working again. 

I'm trying to figure out how that could have happened.  I'm changing these guys in memory, so it shouldn't effect the exe. On top of that it was doing it in BOTH exes. I'm wondering if maybe my computer has a virus or something. 
Title: Re: Sega Model 2 Emulator Full Screen Shooter fix - RamjetM2Borderless - App
Post by: BadMouth on February 18, 2013, 01:39:07 pm
BAH!

Yeah I replaced the exes and they are working again. 

I'm trying to figure out how that could have happened.  I'm changing these guys in memory, so it shouldn't effect the exe. On top of that it was doing it in BOTH exes. I'm wondering if maybe my computer has a virus or something.

Weren't you making changes with a hex editor at some point?
Being that you have been fiddling with the controls and it's an issue with the controls, the fiddling is a much more likely culprit.

Anyways, I'd like to finish the logo tonight.
 I'm going with the "Shoot Harder" version of the logo with the two-tone blue chrome lettering(last one posted), unless you say otherwise.
The only thing I plan to change is make the alignment more precise and maybe make the "2" slightly bigger.  I'll also whip up an icon.
Title: Re: Sega Model 2 Emulator Full Screen Shooter fix - RamjetM2Borderless - App
Post by: Howard_Casto on February 18, 2013, 09:38:33 pm
Well yeah, I was messing with things in the hex editor, but not on both exes. 

It was definately a exe issue... I even re-started my pc, p2 trigger was stuck in both exes.  I copied the exes from the website and they started working properly again. 


Anyway I guess my hex editing adventures aren't over.  Remember those analog control wierdness you and vandale were playing with?  Well when I moved the control bank to p2 it caused issues I wasn't aware of.... just in vcop and vcop 2 mind you.  I'm going to have to find an empty byte somewhere in the code and move the inputs there for those games.  Btw that junk was apparently in the original game... because when I went into the test menu I didn't run into any issues, thus why I thought they were working. 

The issue doesn't effect hotd or any of the other games though, just the vcops. 
Title: Re: Sega Model 2 Emulator Full Screen Shooter fix - RamjetM2Borderless - App
Post by: BadMouth on February 18, 2013, 10:08:36 pm
Remember those analog control wierdness you and vandale were playing with?  Well when I moved the control bank to p2 it caused issues I wasn't aware of.... just in vcop and vcop 2 mind you.  I'm going to have to find an empty byte somewhere in the code and move the inputs there for those games.  Btw that junk was apparently in the original game... because when I went into the test menu I didn't run into any issues, thus why I thought they were working. 

Yeah, I think it was player 2, button 2 that activated the weird joystick controlled crosshairs.
In Gunblade, one of the other buttons pauses the game, but I don't remember which one.
It's too late to do any testing tonight, but I can go through all the games tomorrow evening if need be.

Attached is a logo and some icons. 
I'm considering them final unless you really want something changed.
Title: Re: Sega Model 2 Emulator Full Screen Shooter fix - RamjetM2Borderless - App
Post by: Howard_Casto on February 19, 2013, 04:59:26 am
Fantastic work!  That should do it, the only thing is the icon format.  The Visual Studio 6 languages don't support icons with an alpha channel (32 bit) So save em as 24 bit and we are good to go.  Normally I just use a resource editor to hack them in, but since this will most likely evolve into a taskbar app (I have to render my own icons), I doubt that will work. 

Speaking of icons.  We are going to need to figure out what kind of icon to use.  I tried the MAME ones, and they are a tad bulky imho.  The good news is lua is loading a alpha-based png texture, so translucency can be added.  I don't like the one's in m2, but I think something spindly like that would be best.  The user can make their own icons for that matter, I'm loading an external png in the lua script. 

I tested the other games, they aren't effected.  It's just the vcops.  On the virtua cop games you can get the wierdness even if you press the keyboard key. In other words it's at the game level..  This isn't the case for the other games afaik and keep in mind, I'm controlling the joysticks at this point. 

There could still be issues with the other games... I've only got so many combinations of joysticks afterall, but worst case scenario I can just NOP the registration of directinput and it will make joysticks fall silent on the  m2 end. 

I'll see what I can do.  Probably the safest location to make a custom buffer would be the second output byte.  It isn't used for anything in the lightgun games so hopefully it will stay empty. 
Title: Re: Sega Model 2 Emulator Full Screen Shooter fix - RamjetM2Borderless - App
Post by: Howard_Casto on February 19, 2013, 05:44:44 am
I found a few places that might work... unfortunately the only way to know is to implement and try things. 

0x50169D seems to be inert, it's the byte over from the output byte in vcop.  I can change it's value in a memory editor and it doesn't change back, telling me the games aren't doing anything with it.  Hopefully the code it overwrites doesn't do anything important.  ;)

I'll work on this tomorrow or this evening.  For now I'm ignoring the problem.  I need to get the user interface finished so that a beta can be released. 
Title: Re: Sega Model 2 Emulator Full Screen Shooter fix - RamjetM2Borderless - App
Post by: Trnzaddict on February 19, 2013, 08:52:13 am
Howard fantastic job. A question though, you mentioned that this troubleshooter app will launch model 2 itself...if this going to be arcade front end friendly?
Title: Re: Sega Model 2 Emulator Full Screen Shooter fix - RamjetM2Borderless - App
Post by: Howard_Casto on February 19, 2013, 09:10:29 am
Yes... I wouldn't be going through all of this trouble otherwise. 

M2, will actually be launched normally, but for pc games and the like, t2 will act as a wrapper.  You'll simply treat "troubleshooter.exe" as the emulator and pass a ini file argument as a "rom". 

So "troubleshooter.exe hotdpc" would launch the pc version of house of the dead. 
Title: Re: Sega Model 2 Emulator Full Screen Shooter fix - RamjetM2Borderless - App
Post by: BadMouth on February 19, 2013, 09:13:35 am
Speaking of icons.  We are going to need to figure out what kind of icon to use.  I tried the MAME ones, and they are a tad bulky imho.  The good news is lua is loading a alpha-based png texture, so translucency can be added.  I don't like the one's in m2, but I think something spindly like that would be best.  The user can make their own icons for that matter, I'm loading an external png in the lua script. 

There are the alternate crosshairs for MAME.  http://mrdo.mameworld.info/mame_artwork_supp.php (http://mrdo.mameworld.info/mame_artwork_supp.php)
I also have PNGs from the Digital Leisure games, but don't remember what they looked like (I replaced them with blank PNGs, but still have the originals).
I planned to make laser dots when I get around to adding IR guns to my cab.

I should have time to make up a few different original sets tonight.
I haven't looked for the crosshairs in the M2 folder yet.  Are they just in there as a user accessible png?
If not, I'll need to know the dimensions and other pertinent info.
Title: Re: Sega Model 2 Emulator Full Screen Shooter fix - RamjetM2Borderless - App
Post by: DarthMarino on February 19, 2013, 09:39:56 am
^Is there any harm in making the crosshairs with 2 colors (maybe like a drop shadow).  I do notice occasionally you can lose it if you are aiming at an area that is the same color as your crosshair.
Title: Re: Sega Model 2 Emulator Full Screen Shooter fix - RamjetM2Borderless - App
Post by: Howard_Casto on February 19, 2013, 11:07:38 am
M2's internal crosshairs get broken with my hacks, so I'm making my own.  The lua scripting allows you to load a 32bit png and I can move said png around with the axis values in the game.  I tested this with vcop and gunblade (even though gunblade doesn't need them) it works great. 

So yeah you can make your crosshairs any way you want.  The only catch is that they aren't scaleable.  So I'm going to make the default ones a little on the small side so that they don't look awful at lower resolutions.  Mame's are 500x500 pixels!  And people say mame isn't getting bloated.  ;)  The thought was to make them 48x48.  If you want smaller ones you can simply put a smaller cursor inside the 48x48 image... the transparency won't matter.    Since it's an alpha channel they can be translucent as well.  I've found that helps a lot.  I'll post a script in plain text in the next post so you guys can play with it. 
Title: Re: Sega Model 2 Emulator Full Screen Shooter fix - RamjetM2Borderless - App
Post by: Howard_Casto on February 19, 2013, 11:14:54 am
Here... take the below code, rename to "vcop.lua" and put it in your scripts folder. 

It will attempt to load two 48x48 pngs... cross1.png and cross2.png out of the model 2 folder.  If you don't make some pngs it will crash.  ;)


============================================================================================

require("model2");   -- Import model2 machine globals
--require("ReadLines"); -not used

function Init()
P1CH=Video_CreateSurfaceFromFile("cross1.png")
P2CH=Video_CreateSurfaceFromFile("cross2.png")

end

function PostDraw()

P1AX = (I960_ReadWord(0x501620))
P1AY = (I960_ReadWord(0x501610))
P2AX = (I960_ReadWord(0x501690))
P2AY = (I960_ReadWord(0x5015f8))


width,height = Video_GetScreenSize();   

XPOS = (P1AX - 131) / 495;
XPOS = XPOS * width;

YPOS = ((P1AY - 36) / 383)-1;
YPOS = height+(YPOS * height);


XPOS2 = (P2AX - 131) / 495;
XPOS2 = XPOS2 * width;

YPOS2 = ((P2AY - 36) / 383)-1;
YPOS2 = height+(YPOS2 * height);


--Video_DrawText(XPOS,YPOS,"+",0xff0000)
--Video_DrawText(XPOS2,YPOS2,"+",0x0000ff)

--Video_DrawText(20,20,XPOS,0xff0000)
--Video_DrawText(20,40,YPOS,0x0000ff)   

Video_DrawSurface(P1CH,XPOS-24,YPOS-24)
Video_DrawSurface(P2CH,XPOS2-24,YPOS2-24)

end

=========================================================================================================

Basically all this script does is read the memory addresses that have the x/y values in them.  Then it divides by their maximum values to get the percantage and multiplies the percantage by the screen width or height.  (Y axis has to be negated)  The the loaded cursors are drawn in that position minus 24 (half of 48).  Easy stuff, and we can modify it a lot, like having a key to toggle them on/off and saving the setting. 


Title: Re: Sega Model 2 Emulator Full Screen Shooter fix - RamjetM2Borderless - App
Post by: Howard_Casto on February 19, 2013, 01:22:53 pm
Alright.  I've got a working crosshair script for vcop2 now as well.  So that just leaves house of the dead. 

I'll go ahead and perfect my lua script for gunblade because it's needed for calibration, but I'm going to make it so that you have to toggle that one on.  It is useless for gameplay afterall. 
Title: Re: Sega Model 2 Emulator Full Screen Shooter fix - RamjetM2Borderless - App
Post by: Howard_Casto on February 19, 2013, 01:47:11 pm
Alright... house of the dead now has a working script as well.

Honestly if I knew how easy it was to make my own cursors in lua, I would have never bothered looking for them in the memory. 
Title: Re: Sega Model 2 Emulator Full Screen Shooter fix - RamjetM2Borderless - App
Post by: BadMouth on February 19, 2013, 06:09:42 pm
24 bit icons attached

I tried out your lua script above.
The crosshairs are off from where El-Semi's were.
I'm guessing he adjusted to put the center at the tip of the pointer while yours is centerd on the entire pointer.
As long as the bullets go to the center of the crosshair, we're good.

The background is white because I saved the crosshair without the alpha channel.
This little script is going to be great for creating crosshairs.  Getting to see what they look like in game helps a lot.
Title: Re: Sega Model 2 Emulator Full Screen Shooter fix - RamjetM2Borderless - App
Post by: Howard_Casto on February 19, 2013, 07:25:13 pm
Actually his is off and mine is accurate.  His is placed where the mouse cursor is, no exceptions.  Mine is placed where the game says the gun is. 

Even with calibration in the games, you'll find that his are always just a little off.  Mine still might need a bit of tweaking, but at least they are polling the right values. 

I've got a couple as well I made... they are a little too dim for virtua cop 2 because of that obnoxious yellow circle that goes around the enemies, but I prefer them for hotd. 

Title: Re: Sega Model 2 Emulator Full Screen Shooter fix - RamjetM2Borderless - App
Post by: Howard_Casto on February 19, 2013, 07:25:52 pm
And P2
Title: Re: Sega Model 2 Emulator Full Screen Shooter fix - RamjetM2Borderless - App
Post by: Howard_Casto on February 19, 2013, 07:35:09 pm
Btw most of these games had pc ports.  We could grab a screenshot off the net and make "official" cursors as well. 
Title: Re: Sega Model 2 Emulator Full Screen Shooter fix - RamjetM2Borderless - App
Post by: BadMouth on February 19, 2013, 08:04:06 pm
I'm diggin' having the crosshairs I want.

Not sure if it is an issue or not, but when in the calibration screen (in fullscreen mode) and I move the crosshair off the right side of the screen,
a windows style pointer appears a few inches from the edge of the screen.  If I move it to an area in the bottom right corner of the screen, it turns into the hand with index finger pointer.  It also happens on the screen where you enter your initials. 

Those screens also have a the blue image that appears where a shot is fired following my pointer around.

I'm just using a mouse and not using RamjetR's app.
Title: Re: Sega Model 2 Emulator Full Screen Shooter fix - RamjetM2Borderless - App
Post by: Howard_Casto on February 20, 2013, 05:24:04 am
Well ramjet's app is what fixes those issues.  Again, bad coding unfortuantely.  He made his dx surface fullscreen, but forgot to make the window itself fullscreen. 

The blue splotch is supposed to be there and is part of the game, that's to aid in calibration. 
Title: Re: Sega Model 2 Emulator Full Screen Shooter fix - RamjetM2Borderless - App
Post by: RamjetR on February 20, 2013, 06:13:57 am
Well ramjet's app is what fixes those issues.  Again, bad coding unfortuantely.  He made his dx surface fullscreen, but forgot to make the window itself fullscreen. 

The blue splotch is supposed to be there and is part of the game, that's to aid in calibration.

What he said... Actually I think I had calibration issues when the scene is forced to widescreen, but the min max firing zone wasn't extended outside the 4:3 aspect? At the time I thought most people would be putting this into a cabinet with a CRT so I left the settings default to 4:3 to avoid confusion. That said, I didn't put much time into testing that... The app was just a fix for the M2 focus problem.

The blue and red splotches are in the gun calibration screen and it's easiest to move the target to a particular corner and move the splotch to line up with the crosshair.

Howard, I looked and looked again... even used the CT file I had which modified the crosshairs, but for some reason it didn't work since. Honestly, the crosshairs you have are more accurate anyway and drawn every screen update so probably smoother.

I haven't done anything M2 in atleast a week and with call again from tomorrow (we're down to barebone staff at work) I likely won't have any time for the week to come either. What time I do have available I'm installing my home automation setup and writing/learning HTML interface for Android to arduino/wireless transceivers/IR transceivers. Once that is done, then I'll integrate the home security web camera's and PIR sensors. I've been a bit distracted lately as I've just bought an engagement ring and planning to propose very soon and it's been a bit nerve racking to find the right one and working my arse off to pay for it. Thank god for Howards insomnia hey! :P

Ramjet

Title: Re: Sega Model 2 Emulator Full Screen Shooter fix - RamjetM2Borderless - App
Post by: Howard_Casto on February 20, 2013, 06:46:28 am
Well since mine goes by the gun values and multiplies them by the screen resolution, there shouldn't be any widescreen issues.  Or rather I should say all save one.  If you are running the games on a 16x9 monitor, you need to run them at a 4:3 resolution if you intended to play them in the original aspect.  I can put a 4:3 fix in the lua scripts, but honestly it isn't worth it. 

I'm almost certain that somebody is going to run into calibration issues once this is released... it's the nature of the beast unfortunately.  You've got the in-game calibration.  The calibration of the physical guns, and if it turns out we have issues, I'll implement calibration for the troubleshooter itself.  Lightguns are a pain in the ass really.


Actually, I'm sleeping fairly regularly again.  Note that it's 6am here and I just got up a few minutes ago.   Which is good for me, but it means things might slow down. 

I took a few minutes this morning and started hooking up the cfg menu for the troubleshooter.  It now successfully READS all of the cfg files and also writes to the exe launch options.  What's left on that end is to hook up a few misc options I haven't gotten around to yet, make a custom setup window for VON, and make a model 2 setup section, because basically m2 has to be "installed" unlike the pc games.  On the internal end of things I've still got to add optional joystick support for VON, and thow my mouse code in there.  The mouse code works fine, so it won't be an issue, but bugs can always arise when you are transferring code. 

Good luck on the proposal!
Title: Re: Sega Model 2 Emulator Full Screen Shooter fix - RamjetM2Borderless - App
Post by: BadMouth on February 20, 2013, 10:08:21 am
(probably a useless post, but oh well)

Regarding the issue with the windows pointer appearing:
It was indeed on a widescreen(laptop stretched) to fullscreen.  I don't know what the resolution was set to in M2, but it was probably a 4:3 one.
Not a setup I normally play on.  Sounds like you guys have a handle on it.

Regarding the blue splotch following the crosshairs:
makes sense.  with my Act Labs guns, I pull the trigger and it puts the splotch where I aimed.  It stays there until I pull the trigger again because the position isn't updated again until I pull the trigger.  A side effect of using a mouse or IR gun.
Title: Re: Sega Model 2 Emulator Full Screen Shooter fix - RamjetM2Borderless - App
Post by: Howard_Casto on February 20, 2013, 12:07:27 pm
Found a few more minutes this afternoon. 

Hooked up all the VON joystick stuff save optional analog axis.  I found a bug regarding having the same input hooked up to both a joystick button and keyboard key.  I fixed it for von, but for the lightgun games I'll have to test this evening to see if they need fixed as well. 

If I can get the VON stuff and this potential bug squashed tonight, I'll add in the mouse code and start testing it tomorrow. 
Title: Re: Sega Model 2 Emulator Full Screen Shooter fix - RamjetM2Borderless - App
Post by: Howard_Casto on February 20, 2013, 04:09:53 pm
Ok I got the VON stuff hooked up. 

Confirmed the bug unfortunately.  It has to do with the fact that I allow joystick/mouse and keyboard inputs to work at the same time.  I'll have to rework how I'm handling things a little. 

On a side note, after getting the von stuff working and play testing a few rounds, I have concluded that it's an awful game.  I wonder why I bothered.  ;)
Title: Re: Sega Model 2 Emulator Full Screen Shooter fix - RamjetM2Borderless - App
Post by: BadMouth on February 20, 2013, 09:55:44 pm
laser dots attached if you want to include them with the troubleshooter.
Two sizes and three colors.
The blue sucks, but I thought someone might insist on having blue for P2.
Title: Re: Sega Model 2 Emulator Full Screen Shooter fix - RamjetM2Borderless - App
Post by: edekoning on February 21, 2013, 05:07:30 am
On a side note, after getting the von stuff working and play testing a few rounds, I have concluded that it's an awful game.  I wonder why I bothered.  ;)

Whaaaat? VON is one of my all time favorite arcade games, but you really have to play it with dual trigger sticks against a human opponent.
Title: Re: Sega Model 2 Emulator Full Screen Shooter fix - RamjetM2Borderless - App
Post by: Howard_Casto on February 21, 2013, 07:00:37 am
Badmouth: 

Since you are having so much fun with the crosshairs, here is something else to play with. 

I'm working on a more advanced script that adds more mame-like functionality to the crosshairs.  It's attached below.  It will add a new crosshairs folder as well as a helper script and a script for vcop2.  Just extract it at the root of your m2 folder. 

Holding down the 7 key cycles through available cross hairs for p1, holding down 8 cycles through p2, holding 9 toggles visibility (actually it just loads a blank cursor, but that leads to less "if" statments in the main loop, which should keep things running smoothly).  These keys could be changed of course, even to joystick buttons, but you'd have to google the DIK number. 

The current crosshairs as well as visibility are stored in crosshairs\vcop2.cfg.  When you exit m2, your current settings will be saved for next time. 

You can add/delete your own crosshairs to the mix as well.  They are put in the crosshairs folder.  P1's ch name must end in a "1" and P2's in a "2".  Inside there is also a list file.  Add the name of the cross hair (minus the "1/2.png" to the list) to your list to register it.  Just be sure "NONE" is at the bottom of the list.  No errant returns/spaces in the list either, NONE must be the last line!!!

I need to get back to the main program, but this needs done anyway and it's more fun.  ;)

Anyway, enjoy playing with it. 

Title: Re: Sega Model 2 Emulator Full Screen Shooter fix - RamjetM2Borderless - App
Post by: Howard_Casto on February 21, 2013, 01:07:46 pm
I found a little bit of time this evening to make skeleton forms/functions for configuring VON and Model 2 in general. 

Slowly but surely. 

I still need to fix the previously discovered bug, but it isn't all that serious a one, so I'll wait until I get more time. 
Title: Re: Sega Model 2 Emulator Full Screen Shooter fix - RamjetM2Borderless - App
Post by: BadMouth on February 21, 2013, 10:08:37 pm
^Is there any harm in making the crosshairs with 2 colors (maybe like a drop shadow).  I do notice occasionally you can lose it if you are aiming at an area that is the same color as your crosshair.

Drop this crosshair folder in your MAME folder and see what you think. 
(Mr Do's instructions say crsshair, but the default is now crosshair.  It can be changed in mame.ini)
Probably need to be a little fatter for MAME, but I was trying to stay away from the thick style already available.
You can also open up the MAME crosshairs in a photo editor and outline them in black.

M2 ones in two sizes also in the zip file.
This style and the laser dots were the two I had in mind.
I probably won't make any more.
Title: Re: Sega Model 2 Emulator Full Screen Shooter fix - RamjetM2Borderless - App
Post by: DarthMarino on February 21, 2013, 10:55:30 pm
Yeah, I think it's pretty good.
Title: Re: Sega Model 2 Emulator Full Screen Shooter fix - RamjetM2Borderless - App
Post by: Howard_Casto on February 22, 2013, 07:05:46 am
I like that one as well. 


Fixed that minor bug I was talking about before.  Thus far no issues, so I'll keep plugging away at getting the cfg menus finished.  Hopefully I can get that done tonight and start adding in the mouse stuff tomorrow. 
Title: Re: Sega Model 2 Emulator Full Screen Shooter fix - RamjetM2Borderless - App
Post by: yakk11 on February 22, 2013, 08:47:49 am
I finally fixed my problem.  I didn't have my Aimtrak configured properly for off screen shooting.  Now it works perfectly.    ;D ;D

I really appreciate the hard work you guys have done!    :applaud:  Thanks again!
Title: Re: Sega Model 2 Emulator Full Screen Shooter fix - RamjetM2Borderless - App
Post by: Howard_Casto on February 22, 2013, 09:38:22 am
Good to hear. 

Thankfully I've got plenty of time to work on things today.  I got the save routines for Virtual On hooked up, and combine this with the launch settings I've already done and that's half of the configuration functions righ tthere.  I'll try to hook up the main save functions (which is a mess) later today. 
Title: Re: Sega Model 2 Emulator Full Screen Shooter fix - RamjetM2Borderless - App
Post by: BadMouth on February 22, 2013, 10:10:57 am
Just an FYI, the lua scripts crash the emulator if the last crosshair that was loaded is deleted.

Not sure if you'd consider it an issue or not, but letting you know in case you want to add some lines to avoid it.
Title: Re: Sega Model 2 Emulator Full Screen Shooter fix - RamjetM2Borderless - App
Post by: Howard_Casto on February 22, 2013, 10:33:05 am
Yeah lua doesn't really have a lot of error handling. I can put a check in for "nil" I guess. 

It doesn't actually crash if a crosshair is deleted, but rather if your list is shorter than the crosshair number saved.  Let's say you are using the 6th crosshair and you delete the 4th, making your list only 5 lines long.  It'll still crash. 

Eventually, when I get time, this will all be re-worked anyway.  I'm going to see if I can get it to scan the directory for files instead.  I also want to do that thing mame does, where a crosshair disappears if there's no movement for x-amount of time.  That'll make p2 disappear when you are playing a 1p game. 
Title: Re: Sega Model 2 Emulator Full Screen Shooter fix - RamjetM2Borderless - App
Post by: Howard_Casto on February 22, 2013, 04:04:24 pm
Ok I fixed those issues you mentioned and added a new feature.  I also dropped the NONE crosshairs... at this point the script is too complex to worry about one extra if statement. 

Try this one and let me know how it works.  It has some rudimentary error handling upon startup... if the list number is too high it will revert to the first crosshair... so you'll need at least one.  The new feature is the auto-off.  If a gun stays perfectly still for a second or so (impossible unless it's not in use) the crosshairs will disappear.  They'll come back as soon as they detect movement.  So if you are playing a 1 player game, the second crosshair won't be in your way. 

Rename this to a lua file and try it out. 
Title: Re: Sega Model 2 Emulator Full Screen Shooter fix - RamjetM2Borderless - App
Post by: DarthMarino on February 22, 2013, 08:14:53 pm
Seems to be working for me.  The original Model 2 crosshair remains.  Should I be seeing that?
Title: Re: Sega Model 2 Emulator Full Screen Shooter fix - RamjetM2Borderless - App
Post by: Howard_Casto on February 23, 2013, 08:09:34 am
Seems to be working for me.  The original Model 2 crosshair remains.  Should I be seeing that?

Emulator.ini >  [Renderer] >  DrawCross = 0    ;)
Title: Re: Sega Model 2 Emulator Full Screen Shooter fix - RamjetM2Borderless - App
Post by: Howard_Casto on February 23, 2013, 11:16:15 am
Ok, I got the save routines installed.  Now I've just got to hook up the mouse stuff and do a bit of testing with it. 

Almost there!
Title: Re: Sega Model 2 Emulator Full Screen Shooter fix - RamjetM2Borderless - App
Post by: Howard_Casto on February 23, 2013, 07:38:15 pm
I had to take a break from the main project today.  The "user friendly" interface coding isn't very fun to do at all. 

I DID play around with lua scripting a little.  I wanted to learn the language because learning a new language (even if it's a dumb scripting language) is always a good thing. 

On that note, you guys do know we can further enhance functionality of Model 2 with scripting right?  I decided to make a "pause" screen because model 2 doesn't have any indicator that the game is paused, which makes it hard on me when I do my memory searches with the cheat engine.  I made a png the resolution of my monitor, made a 25% transparent black png, and scripted it to toggle on and off when the pause key is hit.  Bam!  Now model 2 dims the screen when a game is paused, just like mame. 

Other things that are possible are screen filters, cropped bezels, instruction cards, loading control panel images, ect.  And no, I'm not going to hold up the release for stuff like this, I'm just mentioning it.  I don't know what kind of demand there would be for such functionality though.  I was going to add the instruction cards into some of the scripts, but I couldn't find readable artwork for any of the model 2 games. 
Title: Re: Sega Model 2 Emulator Full Screen Shooter fix - RamjetM2Borderless - App
Post by: Howard_Casto on February 24, 2013, 09:09:13 am
Ok mouse/lightgun code is in place.  I tested it and it works great.

Fixed a few minor bugs with the cfg menu. 


So the app is essentially done at this point.  I can't release it yet because I've got to add a function to generate all the lua scripts for model 2 and some documentation would be nice, but the end is finally in sight. 
Title: Re: Sega Model 2 Emulator Full Screen Shooter fix - RamjetM2Borderless - App
Post by: retrorepair on February 24, 2013, 10:40:21 am
Great news, finally these games are going to be properly playable  :applaud:

Thanks for all your hard work Howard!
Title: Re: Sega Model 2 Emulator Full Screen Shooter fix - RamjetM2Borderless - App
Post by: yakk11 on February 24, 2013, 02:14:09 pm
Ok mouse/lightgun code is in place.  I tested it and it works great.

Fixed a few minor bugs with the cfg menu. 


So the app is essentially done at this point.  I can't release it yet because I've got to add a function to generate all the lua scripts for model 2 and some documentation would be nice, but the end is finally in sight.

 :applaud:  Looking forward to blasting zombies with my girlfriend! :D
Title: Re: Sega Model 2 Emulator Full Screen Shooter fix - RamjetM2Borderless - App
Post by: Howard_Casto on February 24, 2013, 06:32:36 pm
Ok not a bug guys, but something I discovered that you should be aware of if you intend to make your own crosshairs ect... 

I was working on the scripts and was going to add bezel and pause screen support as a suprise.  I ran into a issue with the way model 2 loads surfaces from a file.  If the png loaded has dimensions that are not a power of 2 the image gets stretched and/or distorted.  So my 48x48 crosshairs are probably getting a little screwed up.  I'll change the default size to 64x64 instead and add more transparent area, because I feel like some people are going to want large crosshairs.

I'll go ahead and convert the crosshairs I've already been sent, but just keep it in mind. 
Title: Re: Sega Model 2 Emulator Full Screen Shooter fix - RamjetM2Borderless - App
Post by: Howard_Casto on February 26, 2013, 08:32:31 am
Been learning the scripts a little more to make this thing as easy to mod as possible. 

Did some testing to make sure that you can set a variable and THEN load another lua script via an include statment.  Apparently you can, and you can have all your init postdraw and end functions in the other script.  So what I'll do is make a singular script that does all the real work and then generate a bunch of mini scripts, that just set the rom name. 

This way if the users want to modify anything after install (like launching a glovepie script, ect) they only have to modify one script, as opposed to 56. 

So I'll do that today/tonight.  Then I've got business Wednesday and I'll release hopefully on Thursday. 
Title: Re: Sega Model 2 Emulator Full Screen Shooter fix - RamjetM2Borderless - App
Post by: BadMouth on February 26, 2013, 09:47:15 am
Then I've got business Wednesday and I'll release hopefully on Thursday.

 :woot
Title: Re: Sega Model 2 Emulator Full Screen Shooter fix - RamjetM2Borderless - App
Post by: Howard_Casto on February 26, 2013, 10:19:44 am
Well now you've jinxed it.... my HDD will probably crash or something.  ;)

Ok adding in some last minute junk.  I added the code to make the TS as taskbar app.  I also need to add the code to remove the borders (ramjet borderless, ect) and a setting in the ini files to activate it. 

Documentation is going to be a major PITA.  I might release the whole thing without any extensive documentation (heaven help the poor user) and then get some help finishing things up.  Just for the PC games alone I've got to essentially make a html page explaining where the game settings are and what to set them to, like what are on the original troubleshooter site. 

I've got to make the webpage as well. 
Title: Re: Sega Model 2 Emulator Full Screen Shooter fix - RamjetM2Borderless - App
Post by: mike boss on February 26, 2013, 06:48:32 pm
This app is going to be amazing.
Thank you for all the hard work.
Title: Re: Sega Model 2 Emulator Full Screen Shooter fix - RamjetM2Borderless - App
Post by: Howard_Casto on February 27, 2013, 03:17:12 pm
Alright, I'm back home now.  I went ahead and implemented border removal.  Remjet just removes the re-sizers, but I thought I would play it safe and just remove everything. 

Got scared when bel stopped responding, but apparently I somehow corrupted the in-game calibration.  Seriously model 2 seems to randomly screw up the nvram files... I dunno if that's a bug in the emulator, or maybe there are strict setup procedures or what.  Anyway, it's not on my end, so I'm not worrying about it. 

I've got most of the scripts in place at this point, I've just got to write the setup code to make TS2 magically install them and make things work.  I'm pretty tired today so I'll probably end up doing it tomorrow.  That means the release will still be tomorrow, but probably late tomorrow night. 
Title: Re: Sega Model 2 Emulator Full Screen Shooter fix - RamjetM2Borderless - App
Post by: Howard_Casto on February 28, 2013, 09:38:25 am
Ok, I've started filling in the inis for the extra games in model2.  This includes the clones, and the games that don't have any outputs. 

Why add games that don't have outputs?  Well since a lot of people use mamehooker to display marquees, it might be nice to know when the game has started and when it ends, even if there aren't any outputs.  I'll probably find a more elegant solution in later releases, but for now a blank ini should work just fine. 

This last bit of work is mind-numbingly dull so I'll have to pace it out over my free time today.  Then it's a quick write of a function that actually copies these over and we are done. 
Title: Re: Sega Model 2 Emulator Full Screen Shooter fix - RamjetM2Borderless - App
Post by: Howard_Casto on February 28, 2013, 04:52:49 pm
Ugh!  I'm in ini file hell I tell you!


Had more stuff to do today than expected, so I just started on the ini files again.  I'm down to skytarget so far.  I have a lot of the outputs figured out, they are just in cheat files, so I'm transferring as I go.  Even the ones without outputs need a little ini with their window caption and ect, so 56 ini files it is. 

I haven't even touched the lua scripts yet, much less the function I have to write to install all of this. 

I'm still hoping to get this out tonight, but don't be suprised if I wear out and have to finish it tomorrow. 
Title: Re: Sega Model 2 Emulator Full Screen Shooter fix - RamjetM2Borderless - App
Post by: Howard_Casto on February 28, 2013, 06:48:26 pm
Ok, I've been working on the ini files for two hours non-stop.  Finally done with them!

I'll work on the scripts later tonight and wrap this thing up.  So yeah, probably still a release today, but most of you won't be awake for it.  ;)
Title: Re: Sega Model 2 Emulator Full Screen Shooter fix - RamjetM2Borderless - App
Post by: RamjetR on March 01, 2013, 12:53:55 am
Great news Howard! :)

on a side note, I'd like to announce that all went well this time last week and I'm officially engaged. Happy times, it's been a week of celebration and socialising (y'know how people all want to hear how, when and see the ring etc). I'm off call as of last night so finally I have a night spare and maybe a weekend free to test some Wiimotes and play some 2 player VCop! yay!

Been playing more home automation and security... this time I have 433MHz PIR sensors and a Laser tripwire prototypes (that's right... frickin lasers man!) to monitor the exterior of the house and the would be Arcade party garage. Howard you'd love this stuff lol!

Ramjet
Title: Re: Sega Model 2 Emulator Full Screen Shooter fix - RamjetM2Borderless - App
Post by: nipsmg on March 01, 2013, 09:00:17 am
Contrats Ramjet!

Howard:  Really looking forward to this!
Title: Re: Sega Model 2 Emulator Full Screen Shooter fix - RamjetM2Borderless - App
Post by: Howard_Casto on March 01, 2013, 10:15:56 am
Congrats man!


You might be wondering why I haven't released anything yet..... well I've run into another issue.  lua's os.execute isn't working properly for me. 

I can launch a exe from the model2 folder just fine, but ts2 has a lot of files and stuff so it needs a separate directory.  When I try to pass the path, nothing happens.  So I tried a batch file... when the batch file launches, the game feezes  like it's waiting to finish. 

Short of writing a exe to launch the other exe, I'm out of ideas in regards to a solution that launches everything cleanly. 
Title: Re: Sega Model 2 Emulator Full Screen Shooter fix - RamjetM2Borderless - App
Post by: Howard_Casto on March 01, 2013, 11:26:28 am
Ok so I gave up on doing it the right way. 

I made a stub exe file that launches ts2 and closes itself.  Not very elegant, but model 2 is already a hacked up mess anyway. 

I ran into a bug or two as well.  I fixed those up and I managed to write a test script that successfully uses my stub to launch ts2 and everything works fine. 

So I'll write the functions to generate the scripts. 


I'm probably going to wait until this evening..... spent waaaay to much time fixing a particular bug and now my brain is fried. 
Title: Re: Sega Model 2 Emulator Full Screen Shooter fix - RamjetM2Borderless - App
Post by: nipsmg on March 01, 2013, 01:42:45 pm
Thanks for all the hard work man.
Title: Re: Sega Model 2 Emulator Full Screen Shooter fix - RamjetM2Borderless - App
Post by: Howard_Casto on March 01, 2013, 02:42:18 pm
Ok, the setup functions are 90% done.  I'll finish those up after I eat. 

It will still need testing though.  I'm copying over scripts and cfg files, so I want to make sure I don't screw anything up. 
Title: Re: Sega Model 2 Emulator Full Screen Shooter fix - RamjetM2Borderless - App
Post by: RamjetR on March 01, 2013, 04:32:58 pm
Congrats man!


You might be wondering why I haven't released anything yet..... well I've run into another issue.  lua's os.execute isn't working properly for me. 

I can launch a exe from the model2 folder just fine, but ts2 has a lot of files and stuff so it needs a separate directory.  When I try to pass the path, nothing happens.  So I tried a batch file... when the batch file launches, the game feezes  like it's waiting to finish. 

Short of writing a exe to launch the other exe, I'm out of ideas in regards to a solution that launches everything cleanly.

Thanks all :)

When I launched the OSexecute, I kept the exe main in the main folder and sub pathed the icons any any fluffy stuff to it's own path folder in AHK. With the borderless app it would then launch and collate anything it needs to on the fly. It's clean and works fine.

Using that command on a bat file would open a cmd window and execute the batch, but without explicitly telling it to exit in the batch or manually closing the cmd window, it would wait and appear to hang until it was closed. For my app, I just waited untill it saw a cmd window title bar, waited a second to do it's thing and then force closed the window. All good and went on as normal to run the game.

You can have the source of the borderless app if you like. It looks like TS2 is going to superseed it's need anyway and it might be helpful for others to make your own app.

Ramjet
Title: Re: Sega Model 2 Emulator Full Screen Shooter fix - RamjetM2Borderless - App
Post by: Howard_Casto on March 01, 2013, 05:03:39 pm
eh... Ts2 really needs to be in it's own world.  It works for pc games as well after all.  I also expect it to be useful for the racing scene particularly for pc games like outrun 2k6.... if we ever get the time to map the outputs.  ;)

The stub exe is working fine, it's just dumb to have to use a exe to launch another exe, but I guess for a pseudo language like lua we should be thankful that we can launch stuff at all. 


On a side note, just installed IE 10 as it's finally out for windows 7.  HTML 5 and JavaScript support are vastly improved.  Everything is quicker as well.  I highly recommend it. 
Also it has auto spell check for all pages like Chrome, so expect my posts to be legible.  ;)

The app is done now... FINALLY.  The readme.txt still needs to be fleshed out a little so people will know how to use it.  I will work on that later and release tonight.  I wish I could have made setup a bit easier but with all the model 2 madness there's just no way.  Unfortunately I'm sure further tweaks and/or additions to the app will be required in the future.  I stupidly thought this was going to be a two week project.  What has it been?  3 MONTHS?
Title: Re: Sega Model 2 Emulator Full Screen Shooter fix - RamjetM2Borderless - App
Post by: RamjetR on March 01, 2013, 05:26:45 pm
Fantastic news!!! looking forward to a public release soon... documentation... pffft read the manual when all else fails! :P

3 Months?! blimey it has been... but it's been reasonably smooth progress too... lets face it. It was completely new to hybrid hack a x86 x64 program and not just the ROM itself. Top effort and one well worth the wait for the community :)

Congrats again Howard!
Title: Re: Sega Model 2 Emulator Full Screen Shooter fix - RamjetM2Borderless - App
Post by: Endprodukt on March 01, 2013, 07:52:06 pm
3 month worth it. Thank you guys so much!  :applaud: :applaud: :applaud: :applaud:
Title: Re: Sega Model 2 Emulator Full Screen Shooter fix - RamjetM2Borderless - App
Post by: Hunk_4TH on March 01, 2013, 11:20:24 pm
eh... Ts2 really needs to be in it's own world.  It works for pc games as well after all.  I also expect it to be useful for the racing scene particularly for pc games like outrun 2k6.... if we ever get the time to map the outputs.  ;)

The stub exe is working fine, it's just dumb to have to use a exe to launch another exe, but I guess for a pseudo language like lua we should be thankful that we can launch stuff at all. 


On a side note, just installed IE 10 as it's finally out for windows 7.  HTML 5 and JavaScript support are vastly improved.  Everything is quicker as well.  I highly recommend it. 
Also it has auto spell check for all pages like Chrome, so expect my posts to be legible.  ;)

The app is done now... FINALLY.  The readme.txt still needs to be fleshed out a little so people will know how to use it.  I will work on that later and release tonight.  I wish I could have made setup a bit easier but with all the model 2 madness there's just no way.  Unfortunately I'm sure further tweaks and/or additions to the app will be required in the future.  I stupidly thought this was going to be a two week project.  What has it been?  3 MONTHS?
What would you be able to add to Outrun 2006? The main thing I would add if possible is Force feedback. I can't believe Sega didn't include it.
Title: Re: Sega Model 2 Emulator Full Screen Shooter fix - RamjetM2Borderless - App
Post by: retrorepair on March 02, 2013, 01:40:23 am
Ramjetr -> Congratulations!  :applaud:
Title: Re: Sega Model 2 Emulator Full Screen Shooter fix - RamjetM2Borderless - App
Post by: Trnzaddict on March 02, 2013, 08:01:47 am
Thankyou everybody for your work on making Model 2 even better than it is. I'm gonna give this a try this afternoon on my cab with some aimtraks and see how it goes. Any bugs or problems I'll post back.

Thanks again guys.
Title: Re: Sega Model 2 Emulator Full Screen Shooter fix - RamjetM2Borderless - App
Post by: helltraum on March 03, 2013, 12:26:55 pm
Ah hah, Howard is online, wonder if the TS2 release is imminent . . . !   ;D
Title: Re: Sega Model 2 Emulator Full Screen Shooter fix - RamjetM2Borderless - App
Post by: Howard_Casto on March 03, 2013, 12:33:22 pm
You might want to check the troubleshooter 2 thread.  ;)

It's been up. 

A few people are having install issues but so far we've confirmed it to be working on two machines other than mine, so my guess is the bugs are gone, and it's just that... install issues. 
Title: Re: Sega Model 2 Emulator Full Screen Shooter fix - RamjetM2Borderless - App
Post by: marioxb on April 05, 2013, 08:53:35 am
Sweet! So now I can play two player House of the Dead with the arcade graphics and 2 guns! That's the main one I was excited about. How different are the arcade Virtua Cops than the Saturn/ Dreamcast versions? HoTD played fine on Saturn, just had horrible graphics.
Title: Re: Sega Model 2 Emulator Full Screen Shooter fix - RamjetM2Borderless - App
Post by: BigPanik on July 08, 2013, 07:11:10 pm
Hello,

I hope have find an interesting value at address 005577B7 for Daytona with art money. This is the command byte sent to the SEGA drive board for the genuine force feedback.
I try to code a LUA script to catch it (and next send it to SEGA hardware). Unfortunately, the LUA script report a 0. I try, with:
1/I960_ReadByte(0x05577B7)
2/I960_ReadByte(I960_GetRamPtr(0x05577B7))

Someone could help me, please?
Thanks
Title: Re: Sega Model 2 Emulator Full Screen Shooter fix - RamjetM2Borderless - App
Post by: ericitaquera on August 06, 2014, 09:08:39 pm
Thank you, very much!!!!!!!!!

It was very frustrating to play Vcop and Vcop2 before your clever app.

Again: thank you!
Title: Re: Sega Model 2 Emulator Full Screen Shooter fix - RamjetM2Borderless - App
Post by: 5alsabil on October 27, 2018, 09:48:50 pm
Hello and apologies for resurrecting such a dead thread... the info I need is simply nowhere on the web.

In short - I'm using ramjet2borderless to try and get reload off screen working in hotd and I see it activating (systray icon and all) in model 2 v1.1a and it doesn't work. Fullscreen is set to my monitor resolution 2560x1440 but the cursor just goes to the edge of the screen as normal.

I'm using a wiimote and dolphinbar in mode 2 as a light gun.

For extra interest, I'm looking at this solution because dolphinbar happens to flip the A and B buttons when a nunchuk is connected - if it wasn't for that I wouldn't explore this, but shooting with the A button on the TOP of the remote is just a no. And, I can't remap my wiimote buttons as the button configuration built into model 2 doesn't detect A or B - just the 1 and 2 buttons as well as the D-PAD.

Thanks in advance if anyone can help (or even sees this...)

Also I'm using Windows 10 and have tried compatability mode.