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: Make you own MaLa Plugin.  (Read 7116 times)

0 Members and 1 Guest are viewing this topic.

loadman

  • Moderator
  • Trade Count: (+3)
  • Full Member
  • *****
  • Offline Offline
  • Posts: 4306
  • Last login:May 26, 2024, 05:14:32 am
  • Cocktail Cab owner and MaLa FE developer
    • MaLa
Make you own MaLa Plugin.
« on: October 16, 2010, 03:02:58 am »
I finally got around to updating this:

http://malafe.net/files/download/MaLaPluginSDKv1.04.zip

« Last Edit: October 16, 2010, 03:37:36 am by loadman »

drventure

  • Trade Count: (+2)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 4152
  • Last login:April 23, 2024, 06:53:06 pm
  • Laser Death Ray Bargain Bin! Make me an offer!
Re: Make you own MaLa Plugin.
« Reply #1 on: October 23, 2010, 05:41:06 pm »
Hey Loadman

I was working on Engine18 today, finally got some time to upgrade to the latest Mala 1.7.1.0.

Anyway, my addin started crashing where it never had before.

When I finally traced it down, it +looks+ like the signature for MaLaOrientationSwitch has changed.

The Docs (i just downloaded the latest SDK) all describe it as:

Delphi: procedure MaLaOrientationSwitch(orientation: Integer); cdecl;
C++: extern "C" DLL void MaLaOrientationSwitch(int orientation)

And that's the way I had my function exported, but it crashes on me, like so

2010/10/23  16:31:49.91   Info: PLUGIN: Engine18    _OnMaLaListSelected event invoking
2010/10/23  16:31:49.91   Info: PLUGIN: Engine18    _OnMaLaListSelected event invoked
2010/10/23  16:31:49.92   Info: Current Memory used: 39,936 K
2010/10/23  16:31:49.92   Info: SetLayout: No18Arqadium
2010/10/23  16:31:49.92   Info: Loading layout: C:\Games\FrontEnds\Mala\Layouts\No18Arqadium.mll
2010/10/23  16:31:50.26   Debug **: PlugIn Message: Switching to 0
2010/10/23  16:31:50.27   Info: PLUGIN: Engine18    Called ORIENTATIONSWITCH
2010/10/23  16:31:50.27   Error: Exception Message: List index out of bounds (2), Object Function: ChangeDesktopResultion, Exception Class: EListError, Object Class: TfrmMain
2010/10/23  16:31:52.04   Info: Showing taskbar
2010/10/23  16:31:52.06   Debug **: ShowMouse:
2010/10/23  16:31:52.06   Error: AppException: Terminating MaLa



I figured I have to be trashing the stack somehow, just wasn't sure how.

After playing with it awhile I discovered that if I remove the ORIENTATION argument from the export, Mala (and my addins) work just fine.

I just wanted to run this by you and see if it rings any bells.  I could be just missing something on my side, but I've checked and double checked, and it appears that the arg got dropped.

I noticed that LEDBlinky didn't crash, so I investigated further and it turns out it's not exposing that entrypoint, so it wouldn't have any problems.

Engine18, on the other hand, exposes EVERY entry point (so I'll really be giving Mala a good workout!  ;) )

Any ideas?


loadman

  • Moderator
  • Trade Count: (+3)
  • Full Member
  • *****
  • Offline Offline
  • Posts: 4306
  • Last login:May 26, 2024, 05:14:32 am
  • Cocktail Cab owner and MaLa FE developer
    • MaLa
Re: Make you own MaLa Plugin.
« Reply #2 on: October 23, 2010, 07:01:49 pm »
OK. I don't think the plugin SDK is the issue, but rather a bug in the rotation code in general

Do you have any issues changing orientation via (keyboard) or (right mouse click - orientation change) ???

Also, Have you tried the latest Beta?

http://www.malafe.net/files/download/MaLa1720.zip
« Last Edit: October 23, 2010, 07:21:37 pm by loadman »

drventure

  • Trade Count: (+2)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 4152
  • Last login:April 23, 2024, 06:53:06 pm
  • Laser Death Ray Bargain Bin! Make me an offer!
Re: Make you own MaLa Plugin.
« Reply #3 on: October 23, 2010, 07:21:20 pm »
No. I can change orientation just fine, and mala appears to work just fine after changing it.

It's just that if I export that entry point from my mplugin dll, using the published arguments, Mala crashes when it first starts, right after calling the Switchorientation api.

loadman

  • Moderator
  • Trade Count: (+3)
  • Full Member
  • *****
  • Offline Offline
  • Posts: 4306
  • Last login:May 26, 2024, 05:14:32 am
  • Cocktail Cab owner and MaLa FE developer
    • MaLa
Re: Make you own MaLa Plugin.
« Reply #4 on: October 23, 2010, 07:49:17 pm »
No. I can change orientation just fine, and mala appears to work just fine after changing it.

It's just that if I export that entry point from my mplugin dll, using the published arguments, Mala crashes when it first starts, right after calling the Switchorientation api.

Ahh you mean the Orientation Notify rather than what I thought you meant (The MaLa messaging to change orientation remotely) ahh

Yup it makes sense that if there was a problem with that it would do it on MaLa start up as it sends a notify to all plugin so they know what orientation MaLa is starting on (useful for monitor rotation plugins)

loadman

  • Moderator
  • Trade Count: (+3)
  • Full Member
  • *****
  • Offline Offline
  • Posts: 4306
  • Last login:May 26, 2024, 05:14:32 am
  • Cocktail Cab owner and MaLa FE developer
    • MaLa
Re: Make you own MaLa Plugin.
« Reply #5 on: October 23, 2010, 09:59:26 pm »


Is it possible your program is not handling the int=0?

Does this happen when you use the MaLa Stub by Arzoo?

drventure

  • Trade Count: (+2)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 4152
  • Last login:April 23, 2024, 06:53:06 pm
  • Laser Death Ray Bargain Bin! Make me an offer!
Re: Make you own MaLa Plugin.
« Reply #6 on: October 23, 2010, 10:03:04 pm »
I was just going to give MalaStub a shot

I'll let you know.

Thanks!

loadman

  • Moderator
  • Trade Count: (+3)
  • Full Member
  • *****
  • Offline Offline
  • Posts: 4306
  • Last login:May 26, 2024, 05:14:32 am
  • Cocktail Cab owner and MaLa FE developer
    • MaLa
Re: Make you own MaLa Plugin.
« Reply #7 on: October 23, 2010, 10:49:57 pm »
I was just going to give MalaStub a shot

I'll let you know.

Thanks!

If that works possibly Arzoo can shed some light on the problem?

Also. The Delphi compiled version of the Plugin example 'MaLa Messages' works perfectly to show orientation change:

I just compiled it here for you to try:
www.malafe.net/files/download/MaLaEventLogger.zip
« Last Edit: October 23, 2010, 11:07:30 pm by loadman »

drventure

  • Trade Count: (+2)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 4152
  • Last login:April 23, 2024, 06:53:06 pm
  • Laser Death Ray Bargain Bin! Make me an offer!
Re: Make you own MaLa Plugin.
« Reply #8 on: October 24, 2010, 01:49:38 pm »
Ugh. I think I finally figured out what was going wrong.

Since all this is in .net, I was using a little PostCompile process called ExportDLL to, essentially, mark my EntryPoints in such a way that they'll actually be exposed as real entrypoints (so that Mala can see them).

This is all legitimate to do in .net IL but C# nor VB provide any access to it, so you essentially have to compile your DLL, then run a post process step to disassembly the IL, tweak it a bit and then reassemble it.

The nice thing is, since Engine18 is the core addin, once it's compiled right, I can easily create new addins in pure .net (C# or VB) since they all reference the Engine18 dll. So it doesn't require any of this hackishness for any other addin developers that use Engine18 as their base.

At any rate, the ExportDLL post process I was using appears to not quite tweak the IL exactly the way it needs to. It works "mostly" but not 100%, and it just so happens it doesn't work for the simple case of passing an int on the stack (BTW, the MalaOrientationSwitch APPEARS to be passing the Orientation argument by value directly on the stack, not via a pointer, though this could theoretically still be some sleight of  hand that the .net runtime is pulling. I'm not completely sure.

However, in researching it, I found a different developer's solution to doing this.

http://sites.google.com/site/robertgiesecke/

His post build process is all C#, but once I adapted it to VB, it appears to properly tweak the IL and produce a DLL that correctly exposes the entrypoints.

Well, it took all weekend, and I apologize for bothering you about it. The fact that it was working for all the entrypoints that were passing in pointers to structures was just completely throwing me. I couldn't imagine HOW it could work for those complex calls and not for a simple int value on the stack!

Yuck. But, I'm pushing forward again!

Thanks again for looking at this for me

loadman

  • Moderator
  • Trade Count: (+3)
  • Full Member
  • *****
  • Offline Offline
  • Posts: 4306
  • Last login:May 26, 2024, 05:14:32 am
  • Cocktail Cab owner and MaLa FE developer
    • MaLa
Re: Make you own MaLa Plugin.
« Reply #9 on: October 24, 2010, 11:45:50 pm »
Sure  ;)

Glad you worked it out.

If you have any suggestion about how to make the MaLa API more .net friendly (as I don't really directly cater to it at all at the moment) then I am all ears.

drventure

  • Trade Count: (+2)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 4152
  • Last login:April 23, 2024, 06:53:06 pm
  • Laser Death Ray Bargain Bin! Make me an offer!
Re: Make you own MaLa Plugin.
« Reply #10 on: October 25, 2010, 12:33:45 am »
Hey Loadman

Yeah, I'm glad it turned out to be what it was and not anything more sinister.

I'm not really sure how you'd make it anymore .net friendly, without actually redoing Mala in .net and exposing something like the extensibility interfaces through COM. COM support would help, definitely, but I know nothing about COM support in Delphi.

But, really, the plan for me is for Mala to not have to worry about it at all. With any luck, I'll have Engine18 exposing a .net AND COM interfaces for the API, all the settings, tree files, and a limited amount of control over new Window elements that blend in with Mala. I'd really like to get support for doing some WPF stuff integrated with Mala, jeez, that would allow a whole different class of plugin altogether!

But for now, just a slideshow with support for rotated videos would be a good first step!

loadman

  • Moderator
  • Trade Count: (+3)
  • Full Member
  • *****
  • Offline Offline
  • Posts: 4306
  • Last login:May 26, 2024, 05:14:32 am
  • Cocktail Cab owner and MaLa FE developer
    • MaLa
Re: Make you own MaLa Plugin.
« Reply #11 on: October 25, 2010, 02:16:49 am »
But for now, just a slideshow with support for rotated videos would be a good first step!

As you know I use a wrapper for Video.

Whould it be any use to you for me to write a quick app 'MaLa Video Player' Where you could load/Play and rotate video? Would that help get rid of the 'noise' so you can see what is happening with rotate?

drventure

  • Trade Count: (+2)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 4152
  • Last login:April 23, 2024, 06:53:06 pm
  • Laser Death Ray Bargain Bin! Make me an offer!
Re: Make you own MaLa Plugin.
« Reply #12 on: October 25, 2010, 07:23:49 am »
Actually, yes, that could help alot. My original take was to just use the video capabilities in directshow, but there's no rotation ability built in, and I've been stumped as to how to build a filter to do it. I'm now thinking it might be easiest to grab the Mala Video window handle and use it instead, just haven't quite gotten to that point yet.

Even better would be to be able to use the video engine already in Mala to create new video windows as necessary though.

loadman

  • Moderator
  • Trade Count: (+3)
  • Full Member
  • *****
  • Offline Offline
  • Posts: 4306
  • Last login:May 26, 2024, 05:14:32 am
  • Cocktail Cab owner and MaLa FE developer
    • MaLa
Re: Make you own MaLa Plugin.
« Reply #13 on: December 08, 2010, 03:30:11 am »
Here you go I finally got around to it

http://forum.arcadecontrols.com/index.php?topic=107768.0
« Last Edit: December 08, 2010, 03:35:53 am by loadman »

drventure

  • Trade Count: (+2)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 4152
  • Last login:April 23, 2024, 06:53:06 pm
  • Laser Death Ray Bargain Bin! Make me an offer!
Re: Make you own MaLa Plugin.
« Reply #14 on: December 08, 2010, 07:23:06 am »
Very nice. Any chance of getting the source for it?

Actually, it might not matter. WPF seems to have a pretty decent media engine. So far anyway, I've been able to play any video I've thrown at it as well as images.

I'll continue down that path unless there's any walls that spring up.

loadman

  • Moderator
  • Trade Count: (+3)
  • Full Member
  • *****
  • Offline Offline
  • Posts: 4306
  • Last login:May 26, 2024, 05:14:32 am
  • Cocktail Cab owner and MaLa FE developer
    • MaLa
Re: Make you own MaLa Plugin.
« Reply #15 on: December 09, 2010, 01:52:32 am »
You can have it but you won't learn much. Just calls to the wrapper API.

drventure

  • Trade Count: (+2)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 4152
  • Last login:April 23, 2024, 06:53:06 pm
  • Laser Death Ray Bargain Bin! Make me an offer!
Re: Make you own MaLa Plugin.
« Reply #16 on: December 09, 2010, 08:53:26 am »
No problem. I'll continue on with this WPF stuff. It's looking quite promising...

loadman

  • Moderator
  • Trade Count: (+3)
  • Full Member
  • *****
  • Offline Offline
  • Posts: 4306
  • Last login:May 26, 2024, 05:14:32 am
  • Cocktail Cab owner and MaLa FE developer
    • MaLa
Re: Make you own MaLa Plugin.
« Reply #17 on: December 12, 2010, 01:57:15 am »
No problem. I'll continue on with this WPF stuff. It's looking quite promising...

OK I have attached Source (to the other post) just in case it will help you?

http://forum.arcadecontrols.com/index.php?topic=107768.0
« Last Edit: December 12, 2010, 01:59:59 am by loadman »

drventure

  • Trade Count: (+2)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 4152
  • Last login:April 23, 2024, 06:53:06 pm
  • Laser Death Ray Bargain Bin! Make me an offer!
Re: Make you own MaLa Plugin.
« Reply #18 on: December 12, 2010, 10:20:23 am »
Thanks, Loadman!

I pulled the eval dll and it looks like it would work fine for testing purposes. I guess then the question becomes, if I referenced it in my addin, then my plugin is loaded into mala, would the fact that it's registered for mala be enough to turn off the eval limits?

I guess I'll just have to give it a try.

Stormrider

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 318
  • Last login:September 28, 2014, 11:01:54 am
Re: Make you own MaLa Plugin.
« Reply #19 on: March 04, 2011, 06:27:23 am »
Can this be used for my idea of cycling snapshots (in-game/title)?

drventure

  • Trade Count: (+2)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 4152
  • Last login:April 23, 2024, 06:53:06 pm
  • Laser Death Ray Bargain Bin! Make me an offer!
Re: Make you own MaLa Plugin.
« Reply #20 on: March 04, 2011, 07:43:08 am »
Yes, or something like it. Haven't had much chance to play with this in a while. Got sidetracked on a WindowsPhone 7 app. But it's still percolating...

loadman

  • Moderator
  • Trade Count: (+3)
  • Full Member
  • *****
  • Offline Offline
  • Posts: 4306
  • Last login:May 26, 2024, 05:14:32 am
  • Cocktail Cab owner and MaLa FE developer
    • MaLa
Re: Make you own MaLa Plugin.
« Reply #21 on: March 12, 2011, 10:13:50 pm »
..as long as you are having fun.