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

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

  

Author Topic: Software/programming help - arcade unrelated  (Read 287 times)

0 Members and 1 Guest are viewing this topic.

_Iz-

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 693
  • Last login:Today at 01:13:49 am
  • Time to coin up!
Software/programming help - arcade unrelated
« on: May 19, 2024, 07:11:14 pm »
This is unrelated to arcades but during my time on this forum I have read several threads that lead me to believe that someone on here might be able to help me out.

I use a CAD/CAM program called Alphacam at work to fabricate stone countertops. It has VBA integrated that allows us to create macros to automate the repetitive aspects of the job. We have an extensive automation system setup.

There was one item left out of the API for the version of Alphacam we have. The ability to read the state of the autosnap function from the VBA API, or a way to force autosnap into a known state (either on or off). The only thing we can do is toggle it (if it’s on, it turns off, and vice versa) but without being able to tell its current state we don’t know when to toggle.

I currently have an ugly hack in place to detect its state so we can decide to issue the toggle command to put it into the state we want but i’m looking for something better.

There are multiple thread here about hacking programs to get the state of features in game finding memory locations to rwad to add controls or force feedback, etc.

Would it be possible to write a small command line program to find the memory location that stores the autosnap state in alphacam and return a value when the program exits? I have the ability to run such a prpgram from our alphacam macros and import the value it returns. This would be a good solution it it could work.

How would I go about this? Any assistance appreciated.


RandyT

  • Trade Count: (+14)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 6902
  • Last login:Yesterday at 02:56:57 pm
  • Friends don't let friends hack keyboards.
    • GroovyGameGear.com
Re: Software/programming help - arcade unrelated
« Reply #1 on: May 21, 2024, 11:23:13 am »
The company seems to be hiding the API reference, as it's not available on the web, so no way to see if something has been overlooked.

What you want to do is possible, but it's far from a trivial exercise.  When you toggle that function, a hundred different locations in memory could be altered, and finding the correct one which reflects the state may not be easy...if you even know where in memory to start looking.

I have a question...as this is a function of the UI, is this state saved between re-starts of the software?  If so, that data is already being stored somewhere.  The most likely location would be in the app config data area in the registry.  The first thing I would do is a registry search for Alphacam and see what is being stored and how often. If the state happens to be available from there, and it's updated in real-time, then reading that would be your best solution.

You say you have a "hack" in place to determine the current state.  I'm guessing it is along the lines of placing a dummy object near a snap point and determining whether the objects location moved to that point or was placed at the actual co-ordinates.  If not, and barring other options, that doesn't seem like the worst approach.

_Iz-

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 693
  • Last login:Today at 01:13:49 am
  • Time to coin up!
Re: Software/programming help - arcade unrelated
« Reply #2 on: May 21, 2024, 01:27:45 pm »
The autosnap state is not saved. The program always starts with autosnap off.

The 2022 version added a way to force autosnap off from the API. We use the 2014 version and its not likely the company will pay to upgrade.

The UI displays the word AUTO at the bottom right corner of the screen in a message bar when autosnap is on and that box is blank when its off. My hack is to get the screen coordinates of the alphacam window and then have the API call an external program that uses those coordinates to screenshot just the tiny box where AUTO is displayed and save it to a file. Then i call another external program to compare that pic to one taken previously with autosnap off. If the pics match autosnap is off. If they don’t match then autosnap is on. I feed the match result back into the API and use that to decide if I should toggle autosnap or not to get the state I want. This hack is not perfect, and can be affected by window size and things covering the part of the screen where AUTO is didplayed.

If i could find the memory location that stores the autosnap state, is writing an external program to read that memory location and return its value possible? There is a program called cheat engine that looks like it is designed to find stuff like that, though I admit it would not be trivial to find what I’m looking for.

RandyT

  • Trade Count: (+14)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 6902
  • Last login:Yesterday at 02:56:57 pm
  • Friends don't let friends hack keyboards.
    • GroovyGameGear.com
Re: Software/programming help - arcade unrelated
« Reply #3 on: May 21, 2024, 02:01:16 pm »
The autosnap state is not saved. The program always starts with autosnap off.

That actually makes it pretty easy to deal with, but only if the process is fully automated or if you can disable that UI element/keyboard shortcut, either in the UI or with your code.  If you don't need to be concerned with the user enabling this function outside of code, self-tracking the state is trivial. First toggle turns it on, next off, ad infinitum.

Quote
If i could find the memory location that stores the autosnap state, is writing an external program to read that memory location and return its value possible? There is a program called cheat engine that looks like it is designed to find stuff like that, though I admit it would not be trivial to find what I’m looking for.

Maybe there's someone here (like Howard) who could help you with that, if you really want software running with the required permissions on your business machines.  Personally, I'd take the route above or the "hack" I outined in the previous post.  It seems like placing a dummy point or object close to a snap point and then reading back the actual location would tell whether that location snapped or didn't, but I'm not familiar enough to know whether that approach is viable.