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: Building Plugins with Delphi XE (Latest version) * Solution *  (Read 4641 times)

0 Members and 1 Guest are viewing this topic.

pb_sask

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 15
  • Last login:July 13, 2011, 10:59:40 am
I wanted to write a quick plugin to display marquees on a second monitor by modifying the sample project, which I was able to successfully test using the malastub app.  However when I want to display and image, I am taking the Marquee folder + rom + '.png' this is where the problem starts, if I dump this to a text field (Actually i used the form caption), the data passed to the type record is garbaged, its in japanese??? I tried opening the sample project and compiled it without any of my changes and I got the same thing the output file looks like this:
*************************************************************
EVENT: MaLa start

*************************************************************
EVENT: Game selected
Name: ?????????????)???C?N
Manufacturer: ???
Genre: ?????????l??
Year: 1993
Clone of: ??@??????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????Q?????j?u

I dont know if theres some compiler options I need or not or if Mala plugins just aint possible with the later versions of delphi.

I did try Lazarus but way to much effort just to display a png :D
« Last Edit: July 03, 2011, 04:19:55 am by loadman »

pb_sask

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 15
  • Last login:July 13, 2011, 10:59:40 am
Re: Plugins with Delphi XE (Latest version)
« Reply #1 on: June 30, 2011, 08:27:00 am »
Just to Update, I tried Lazarus and this just shuts down MaLaStub or throws an error, for me anyway

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: Plugins with Delphi XE (Latest version)
« Reply #2 on: July 01, 2011, 12:05:46 am »
Yeah You probably can't as beyond Delphi 2007 they introduced  'unicode' support. Possibly that is effecting the message passing? Maybe there is a mode you can set to make code backward compatible?

pb_sask

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 15
  • Last login:July 13, 2011, 10:59:40 am
Re: Plugins with Delphi XE (Latest version)
« Reply #3 on: July 02, 2011, 05:49:11 am »
Yeah You probably can't as beyond Delphi 2007 they introduced  'unicode' support. Possibly that is effecting the message passing? Maybe there is a mode you can set to make code backward compatible?

Thats pretty rubbish :( I will look throught the options, but as this would be the first time I have used delphi I aint really sure where I would look.  Guess I will look for a 2007 version....

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: Plugins with Delphi XE (Latest version)
« Reply #4 on: July 03, 2011, 12:38:12 am »
Yeah You probably can't as beyond Delphi 2007 they introduced  'unicode' support. Possibly that is effecting the message passing? Maybe there is a mode you can set to make code backward compatible?

Thats pretty rubbish :( I will look throught the options, but as this would be the first time I have used delphi I aint really sure where I would look.  Guess I will look for a 2007 version....

It was only a guess.  :dunno

I have a copy of Delphi 2010 (which is one version down from XE so I guess I could try it?

Also maybe I could buy the cheap Starter version of Delphi XE  version and try and see if I can build plug-ins....?

http://www.embarcadero.com/products/delphi/starter

OK I just spent AU$194 more of my hard earnt cash at the MaLa project buying the uprgade version of Delphi XE Starter.

I will now see if I can make a plugin work
« Last Edit: July 03, 2011, 12:45:49 am by loadman »

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: Plugins with Delphi XE (Latest version)
« Reply #5 on: July 03, 2011, 01:52:10 am »
OK I confirm your findings.....

Using the same Plug-in sample code (provided with the MaLa plugin SDK) MaLaEventLogger I can see differences on the messages received by the Plugin build in 2007 compared to the one buile in Deplhi XE.

It receives the event calls OK but the 'string' data passed is rubbish. INtegers looks like they are passed ok.

I will see if there is anything I can do to fix this

Delphi 2007:
*************************************************************
EVENT: MaLa start -

*************************************************************
EVENT: Emulator selected
Name: M.A.M.E. v0.89 (Nov 24 2004)
Executable: C:\mametable\mame\mame89.exe
Command line: %rom%
-------------------- ROMFILES -------------------------------
Rom path: C:\mametable\mame\roms,,
Rom extensions: zip
-------------------- IMAGES ---------------------------------
Snap path: C:\mametable\mame\snaps
Marquee path: C:\Executable\marquee
CPanel path: C:\Executable\cpanel
Video path: C:\mametable\Videos
-------------------- ENCODER PROGRAMMING --------------------
Encoder default config file:
Encoder game based: 0
Encoder config file path:
Encoder config file extension:

*************************************************************
EVENT: Gamelist selected
Name: All Games
Game count: 201
Filter count: 201

*************************************************************
EVENT: Orientation switch
Orientation: 0

*************************************************************
EVENT: Game selected
Name: Paperboy (rev 1)
Manufacturer: Atari Games
Genre: Misc.
Year: 1984
Clone of: paperboy
-------------------- INPUTS ---------------------------------
Coins: 3
Buttons: 2
Players: 2P alt
Control: stick
-------------------- VIDEO ----------------------------------
Screen: raster
Orientation: horizontal
Video size: 512x384
-------------------- DRIVER ---------------------------------
Status: good
-------------------- CONTROLS.INI ---------------------------
Control: Misc
JoyUp:
JoyDown:
JoyLeft:
JoyRight:
Button1: Throw
Button2: Throw
Button3: not used
Button4: not used
Button5: not used
Button6: not used
Button7: not used
Button8: not used
-------------------- ROMFILE --------------------------------
Rom name: paperbr1
Rom path: C:\mametable\mame\roms
Rom extension: zip
-------------------- STATS ----------------------------------
Game played: 0

*************************************************************
EVENT: Game selected
Name: Pac-Man Plus
Manufacturer: [Namco] (Midway license)
Genre: Maze
Year: 1982
Clone of:
-------------------- INPUTS ---------------------------------
Coins: 2
Buttons: 1
Players: 2P alt
Control: joy4way
-------------------- VIDEO ----------------------------------
Screen: raster
Orientation: vertical
Video size: 224x288
-------------------- DRIVER ---------------------------------
Status: good
-------------------- CONTROLS.INI ---------------------------
Control: 4-way Joystick
JoyUp: Up
JoyDown: Down
JoyLeft: Left
JoyRight: Right
Button1: not used
Button2: not used
Button3: not used
Button4: not used
Button5: not used
Button6: not used
Button7: not used
Button8: not used
-------------------- ROMFILE --------------------------------
Rom name: pacplus
Rom path: C:\mametable\mame\roms
Rom extension: zip
-------------------- STATS ----------------------------------
Game played: 0

*************************************************************
EVENT: Game selected
Name: Pac-Man (Midway)
Manufacturer: [Namco] (Midway license)
Genre: Maze
Year: 1980
Clone of: puckman
-------------------- INPUTS ---------------------------------
Coins: 2
Buttons: 1
Players: 2P alt
Control: joy4way
-------------------- VIDEO ----------------------------------
Screen: raster
Orientation: vertical
Video size: 224x288
-------------------- DRIVER ---------------------------------
Status: good
-------------------- CONTROLS.INI ---------------------------
Control: 4-way Joystick
JoyUp: Up
JoyDown: Down
JoyLeft: Left
JoyRight: Right
Button1: not used
Button2: not used
Button3: not used
Button4: not used
Button5: not used
Button6: not used
Button7: not used
Button8: not used
-------------------- ROMFILE --------------------------------
Rom name: pacman
Rom path: C:\mametable\mame\roms
Rom extension: zip
-------------------- STATS ----------------------------------
Game played: 0

*************************************************************
EVENT: MaLa quit

*************************************************************

Delphi XE:
*************************************************************
EVENT: MaLa start

*************************************************************
EVENT: Emulator selected
Name: ?????????6????
Executable: ??????????????
Command line: ??%0
-------------------- ROMFILES -------------------------------
Rom path: ????????????
Rom extensions: ?p????????
-------------------- IMAGES ---------------------------------
Snap path: ???????????s
Marquee path: ??????????e
CPanel path: ??????????
Video path: ?????????s??
-------------------- ENCODER PROGRAMMING --------------------
Encoder default config file: ??@??????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????Q?????j?u
Encoder game based: 0
Encoder config file path: ??@??????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????Q?????j?u
Encoder config file extension: ??@??????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????Q?????j?u

*************************************************************
EVENT: Gamelist selected
Name: ????s
Game count: 201
Filter count: 201

*************************************************************
EVENT: Orientation switch
Orientation: 0

*************************************************************
EVENT: Game selected
Name: ????????
Manufacturer: ????????????
Genre: ??
Year: 1980
Clone of: ???n
-------------------- INPUTS ---------------------------------
Coins: 2
Buttons: 1
Players: ???
Control: ???y
-------------------- VIDEO ----------------------------------
Screen: ???
Orientation: ????
Video size: 224x288
-------------------- DRIVER ---------------------------------
Status: ??
-------------------- CONTROLS.INI ---------------------------
Control: ???????
JoyUp: ?
JoyDown: ??
JoyLeft: ??
JoyRight: ??t
Button1: ?4??
Button2: ?4??
Button3: ?4??
Button4: ?4??
Button5: ?4??
Button6: ?4??
Button7: ?4??
Button8: ?4??
-------------------- ROMFILE --------------------------------
Rom name: ???
Rom path: ???????????
Rom extension: ?p??
-------------------- STATS ----------------------------------
Game played: 0

*************************************************************
EVENT: MaLa quit
« Last Edit: July 03, 2011, 01:55:25 am by loadman »

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: Plugins with Delphi XE (Latest version)
« Reply #6 on: July 03, 2011, 04:19:04 am »
OK I worked it out  ;D  :cheers:

You can create Plug_ins using Delphi XE    :applaud:   :cheers:    ;)

The only thing is due to 'Unicode' changes in Delphi 2009+ you need to treat strings differently.

This is easily done and is backward compatible.

Simply search and replace PChar with PAnsiChar in MaLaEventLogger.dll and eventdata.pas


I will change the SDk doc and exple in the next MaLa release..

Have fun  :applaud:

pb_sask

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 15
  • Last login:July 13, 2011, 10:59:40 am
Re: Building Plugins with Delphi XE (Latest version) * Solution *
« Reply #7 on: July 04, 2011, 10:07:52 am »
Thx loadman

I had found this solution as well, the only issue is that this would cause a performance hit, I dont think its an issue with a MaLa plugin as this is pretty low overhead in the main.  Sorry you had to purchase the XE version, I didnt have time to post the solution as I had been quite busy over the weekend.

Dont know if this is a noobie thing to say but another thing to note is that PAnsiChar doesnt always work the same as PChar, I dont know why, as i said I am not into Dephi at all.   Once I did a find and replace to PAnsiChar, I couldnt compile my app due to a concatenation issue with Form1.Caption:=PAnsiChar + PAnsiChar + 'Some text'; I tried using strcat, but hit another error on compilation, in the end I declared my variable as string and just did String(PAnsiChar).

Gray_Area

  • -Banned-
  • Trade Count: (+1)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 3363
  • Last login:June 23, 2013, 06:52:30 pm
  • -Banned-
Re: Building Plugins with Delphi XE (Latest version) * Solution *
« Reply #8 on: July 04, 2011, 01:25:01 pm »
OK I just spent AU$194 more of my hard earnt cash at the MaLa project buying the uprgade version of Delphi XE Starter.

I'm surprised you didn't hit a Delphi forum, first......
-Banned-

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: Building Plugins with Delphi XE (Latest version) * Solution *
« Reply #9 on: July 04, 2011, 11:50:51 pm »
OK I just spent AU$194 more of my hard earnt cash at the MaLa project buying the uprgade version of Delphi XE Starter.

I'm surprised you didn't hit a Delphi forum, first......

I wanted an excuse to buy to see if I could build MaLa in XE  ;)