Recent

Author Topic: Lazarus compile Error: Illegal parameter: -WB00400000  (Read 904 times)

nooneherereally

  • Newbie
  • Posts: 3
Lazarus compile Error: Illegal parameter: -WB00400000
« on: September 10, 2022, 06:08:22 pm »
I am trying to compile cheat engine (source here : https://github.com/cheat-engine/cheat-engine )
I Am running https://nobaraproject.org/ which is fedora with third party codecs preinstalled for my work environment.

I twitted the dev of cheat engine asking for some advice, and this is how he responded.
https://imgur.com/a/clxaSpA

Have a guy on an mac ARM also try to run an compile on Mac os 12.51.1 on arm m1 however he runs into a different compile issue, its a source code error.


MarkMLl

  • Hero Member
  • *****
  • Posts: 5862
Re: Lazarus compile Error: Illegal parameter: -WB00400000
« Reply #1 on: September 10, 2022, 10:14:28 pm »
I think your question amounts to

Quote
I'm trying to compile something which is Windows specific for Linux, and have been advised to "Just replace all the Windows specific function calls with equivalent versions for Linux".

Where do I start?

MarkMLl
MT+86 & Turbo Pascal v1 on CCP/M-86, multitasking with LAN & graphics in 128Kb.
Pet hate: people who boast about the size and sophistication of their computer.
GitHub repositories: https://github.com/MarkMLl?tab=repositories

marcov

  • Administrator
  • Hero Member
  • *
  • Posts: 10484
  • FPC developer.
Re: Lazarus compile Error: Illegal parameter: -WB00400000
« Reply #2 on: September 10, 2022, 10:45:16 pm »
And -WB is windows specific:

Quote from: FPC -h
-WB<x>     Set image base to <x> (Windows, Symbian)

KodeZwerg

  • Hero Member
  • *****
  • Posts: 898
  • Fifty shades of code.
    • Delphi & FreePascal
Re: Lazarus compile Error: Illegal parameter: -WB00400000
« Reply #3 on: September 11, 2022, 12:47:20 am »
Quote
$ sudo apt install gameconqueror
It be faster to install that instead try to convert a zillion of lines of code into something that is linux compatible.
« Last Edit: Tomorrow at 31:76:97 by KodeZwerg »

MarkMLl

  • Hero Member
  • *****
  • Posts: 5862
Re: Lazarus compile Error: Illegal parameter: -WB00400000
« Reply #4 on: September 11, 2022, 09:43:12 am »
Quote
$ sudo apt install gameconqueror
It be faster to install that instead try to convert a zillion of lines of code into something that is linux compatible.

But that doesn't answer OP's problem. Perhaps what he wants to do is engage with Cheat Engine's developers, and feels that converting it to Linux- with which he is familiar- is the best way of doing so. Looking at it from that POV, I'd suggest that telling him bluntly to go away and use a tool written in a less unpopular language doesn't present this community in a favourable light.

I think the way I'd put it is that it might /possibly/ be worth investigating GameConqueror as an alternative. However if OP wants to work on Cheat Engine then the first thing is to find out where that -WB option is getting in (assuming he's using the Lazarus IDE, the compilation or link options settings) and to see what happens when he removes it and selects GTK2 as the widgetset.

Allowing for how comprehensive the LCL's GUI support etc. is, I'd be very disappointed if there were substantial issues in that area. Far more of a problem would be if the project were e.g. using Windows debugging facilities to interact with other running programs.

MarkMLl
MT+86 & Turbo Pascal v1 on CCP/M-86, multitasking with LAN & graphics in 128Kb.
Pet hate: people who boast about the size and sophistication of their computer.
GitHub repositories: https://github.com/MarkMLl?tab=repositories

KodeZwerg

  • Hero Member
  • *****
  • Posts: 898
  • Fifty shades of code.
    • Delphi & FreePascal
Re: Lazarus compile Error: Illegal parameter: -WB00400000
« Reply #5 on: September 11, 2022, 11:41:17 am »
Yes, i was expressing myself wrong, possible is everything, in that case he really "just" need to know deep knowledge of the Windows Api and the Linux kernel to find its proper replacements, like the original devs wrote.
From point of Windows Api, i am very familar with and can explain a lot that might help to find out how-to on other OS.
From point of Target OS, you are the experts to be helpful on finding proper units and methods etc.  O:-)
« Last Edit: Tomorrow at 31:76:97 by KodeZwerg »

MarkMLl

  • Hero Member
  • *****
  • Posts: 5862
Re: Lazarus compile Error: Illegal parameter: -WB00400000
« Reply #6 on: September 11, 2022, 01:28:30 pm »
I wouldn't say /wrong/, just a bit too abruptly to be constructive or friendly :-)

I've not looked at OP's project in detail, but the one you mentioned is quite blunt about needing access to some other program's memory. That suggests that it either wants a debugging interface, or access as described in (the accepted answer to) https://unix.stackexchange.com/questions/6301/how-do-i-read-from-proc-pid-mem-under-linux ; this is almost certain to need either root privilege or extra POSIX capabilities.

Noting that some subprojects are supplied as .sln files, I'd be very cautious about running VSCode on any Linux system that can't be terminated "with extreme prejudice". I'm still trying to work out what I've seen, but I /think/ that there's some interaction between a daemon supplied as part of VSCode, and any cloned(?) GitHub project; the result that I think I've seen was sufficient network traffic to severely impact the reliability of any local apps using datagrams (i.e. UDP or ICMP) even after a system reboot.

MarkMLl
« Last Edit: September 11, 2022, 02:06:11 pm by MarkMLl »
MT+86 & Turbo Pascal v1 on CCP/M-86, multitasking with LAN & graphics in 128Kb.
Pet hate: people who boast about the size and sophistication of their computer.
GitHub repositories: https://github.com/MarkMLl?tab=repositories

nooneherereally

  • Newbie
  • Posts: 3
Re: Lazarus compile Error: Illegal parameter: -WB00400000
« Reply #7 on: September 11, 2022, 05:35:05 pm »
Holy cow this blew up. Thank you all for you responses, I go from top to bottom.
So let me define some goals of this project/attempt and other goals.
So There is alot of contextual parts to this, and I mainly function from a Stream of consciousness style of though.

Cheat engine is a pascal, and Developed SOLELY in lazarus, so I was hoping since lazarus supported cross compile and was cross platform, that there may be a chance to get ti running. why?

I recently getting back into PlayStation 2 games, and been using what pcsx2 software calls .pnach files (which is just hex edited memory) to allow things, such as 60fps, true non-anthropomorphic 16:9(21:9, and 32:9) and others as well), and now with some talent, one of the first external mods for https://www.reddit.com/r/DarkCloud/comments/vp5gcc/dc1_dark_cloud_enhanced_mod_release/ was made for dark cloud, launch title for ps2.

its a simple real time, memory changing via simple code in visual studio for windows rn, but it just using pcsx2 api iirc to change values on the fly, in real time, so the game doesnt crashes. i.e when XXXXX000 hit change to XXXXX001 then back when XXXX002 then back, so a set of loops and conditional statements.

so why all this if it works on windows and most of the other people use windows, shouldn't I just windows, if you have to ask or cant get past thing and understand that its more then pure pragmatic-ism, then please reframe, im not here to fight, im here to solve my issues and move forward, and learn to fish.

The mod is windows only atm however, but ive been talking to the dev, and I think they are willing to let me attempt a linux port of the code. or at least access to the source to attempt to get it to run. so learning anything to achieve that goal of playing this in native Linux

Quote
$ sudo apt install gameconqueror
It be faster to install that instead try to convert a zillion of lines of code into something that is linux compatible.

so why not use game conquer? I am, and do have it installed Btw its Sudo Dnf Install not apt get :)

I just used cheat engine, everyone making patches for pcsx2 uses cheat engine, the values and interface isnt the same, and most guides are again written for cheat engine.

either way i got work I have to do. I have to blindy hunt for hex values with cheat engine, and then hunt other random values, reload the save state of the ram of the pcsx2 emulator, and then write a .pnach file.

iirc cheat engine also has lua scripting and modules. so in thoery I chould just make a cheat engine patch for a game, and not have to worry about copyright infringement.

I think your question amounts to

Quote
I'm trying to compile something which is Windows specific for Linux, and have been advised to "Just replace all the Windows specific function calls with equivalent versions for Linux".

Where do I start?

MarkMLl


Yes, I have done simple coding for embedded things 10 years ago on a cyclone iii and VHD(leds and switches) and simple bash script via nano. I do know how to route pcbs and hand re flow a board, even SMD with hot air/by hand. so Ive always been more hardware orientated then software. I can even compile gentoo and follow the manual, and even do some of my our configs. I would say in between a novice and intermediate.

And -WB is windows specific:

Quote from: FPC -h
-WB<x>     Set image base to <x> (Windows, Symbian)

so its a change I still need to make within the source correct?

I wouldn't say /wrong/, just a bit too abruptly to be constructive or friendly :-)

I've not looked at OP's project in detail, but the one you mentioned is quite blunt about needing access to some other program's memory. That suggests that it either wants a debugging interface, or access as described in (the accepted answer to) https://unix.stackexchange.com/questions/6301/how-do-i-read-from-proc-pid-mem-under-linux ; this is almost certain to need either root privilege or extra POSIX capabilities.

Noting that some subprojects are supplied as .sln files, I'd be very cautious about running VSCode on any Linux system that can't be terminated "with extreme prejudice". I'm still trying to work out what I've seen, but I /think/ that there's some interaction between a daemon supplied as part of VSCode, and any cloned(?) GitHub project; the result that I think I've seen was sufficient network traffic to severely impact the reliability of any local apps using datagrams (i.e. UDP or ICMP) even after a system reboot.

MarkMLl



Cheat engine is pascal, written purely in lazarus ide, the only thing windows specific is the calls and the dark cloud enhance mod.exe , yes cheat engine is playing with privilege memory, so it will need root as it runs in keneral space on windows iirc.


PascalDragon

  • Hero Member
  • *****
  • Posts: 4872
  • Compiler Developer
Re: Lazarus compile Error: Illegal parameter: -WB00400000
« Reply #8 on: September 11, 2022, 06:02:29 pm »
Cheat engine is a pascal, and Developed SOLELY in lazarus, so I was hoping since lazarus supported cross compile and was cross platform, that there may be a chance to get ti running. why?

Some code being written in a cross platform capable language/environment does not mean that the code itself is cross platform when it uses platform specific functionality that is not available on the platform question.

MarkMLl

  • Hero Member
  • *****
  • Posts: 5862
Re: Lazarus compile Error: Illegal parameter: -WB00400000
« Reply #9 on: September 11, 2022, 06:50:50 pm »
Cheat engine is a pascal, and Developed SOLELY in lazarus, so I was hoping since lazarus supported cross compile and was cross platform, that there may be a chance to get ti running. why?

Yes, but it also supports talking to the OS's native API(s). If a developer uses those extensively then the result is non-portable

Quote
Yes, I have done simple coding for embedded things 10 years ago on a cyclone iii and VHD(leds and switches) and simple bash script via nano. I do know how to route pcbs and hand re flow a board, even SMD with hot air/by hand. so Ive always been more hardware orientated then software. I can even compile gentoo and follow the manual, and even do some of my our configs. I would say in between a novice and intermediate.

I'd be inclined to say that somebody with HDL experience could, if he chose, claim to be beyond novice in most things.

But would be unlikely to, since he knows the importance of reading documentation and approaching things methodically.

Quote
yes cheat engine is playing with privilege memory, so it will need root as it runs in keneral space on windows iirc.

No, you'd be better using POSIX capabilities since that means that you can do all your development and most of your debugging without having root. You /do/ have to put an extra command to be run post-build, but then you can start the program from a shell session and then tell the IDE to attach a debugger to it (simply running the program from the IDE causes the capability to be lost because a debugger is interposed)... I contributed an IDE patch so make that easier, GOK what happened to it.

MarkMLl
MT+86 & Turbo Pascal v1 on CCP/M-86, multitasking with LAN & graphics in 128Kb.
Pet hate: people who boast about the size and sophistication of their computer.
GitHub repositories: https://github.com/MarkMLl?tab=repositories

nooneherereally

  • Newbie
  • Posts: 3
Re: Lazarus compile Error: Illegal parameter: -WB00400000
« Reply #10 on: September 11, 2022, 08:17:27 pm »
Cheat engine is a pascal, and Developed SOLELY in lazarus, so I was hoping since lazarus supported cross compile and was cross platform, that there may be a chance to get ti running. why?

Yes, but it also supports talking to the OS's native API(s). If a developer uses those extensively then the result is non-portable

Quote
Yes, I have done simple coding for embedded things 10 years ago on a cyclone iii and VHD(leds and switches) and simple bash script via nano. I do know how to route pcbs and hand re flow a board, even SMD with hot air/by hand. so Ive always been more hardware orientated then software. I can even compile gentoo and follow the manual, and even do some of my our configs. I would say in between a novice and intermediate.

I'd be inclined to say that somebody with HDL experience could, if he chose, claim to be beyond novice in most things.

But would be unlikely to, since he knows the importance of reading documentation and approaching things methodically.

Quote
yes cheat engine is playing with privilege memory, so it will need root as it runs in keneral space on windows iirc.

No, you'd be better using POSIX capabilities since that means that you can do all your development and most of your debugging without having root. You /do/ have to put an extra command to be run post-build, but then you can start the program from a shell session and then tell the IDE to attach a debugger to it (simply running the program from the IDE causes the capability to be lost because a debugger is interposed)... I contributed an IDE patch so make that easier, GOK what happened to it.

MarkMLl

well, with the dev saying it should be possible just switching commands, what books would you recommend to read to educate myself? overall, again looking to learn how to fish, not be given fish.

MarkMLl

  • Hero Member
  • *****
  • Posts: 5862
Re: Lazarus compile Error: Illegal parameter: -WB00400000
« Reply #11 on: September 11, 2022, 09:52:17 pm »
well, with the dev saying it should be possible just switching commands, what books would you recommend to read to educate myself? overall, again looking to learn how to fish, not be given fish.

What the dev's saying is "Frankly, my dear, I don't give a damn".

What you need to do is find what portions of the program import the Windows unit, comment that out, and find what breaks. You are likely to find that most if not all of the GUI-related stuff can either be replaced by LCL components etc. (i.e. on Linux typically using GTK2), or is unnecessary window dressing. However the debugger (or whatever) interface will be more problematic.

The two indispensable references are https://www.freepascal.org/docs.html for the current FPC/RTL, and https://lazarus-ccr.sourceforge.io/docs/ for the current Lazarus IDE/LCL plus its preferred version of FPC. My understanding is that Windows reference material is readily available, but the regrettable fact is that Linux (plus X11 plus GTK etc.) documentation has no centralised definitive reference.

Thinking about it, my suggestion would be to fork the project, set yourself up a Windows machine (possibly in a VM since you don't need many frills) and rebuild the project moving all the GUI stuff to the Qt widget set. That should leave you with a functional and testable copy of the project running on Windows, plus a clear understanding of the bits that can't be easily ported (which I speculate to be some sort of debugger or cross-process interface).

I'm neither a gamer nor a debugger guru and haven't prodded Windows in anger for approaching 20 years, but whilst I can't make promises on behalf on anybody else it's likely that the overall community will be happy to give advice... mostly appropriate and useful.

I would suggest however that if you intend to continue this thread rather than at some point starting a new one it would be worth editing your original posting to make the subject line read e.g. "Making a Windows-specific project portable" since that's what accurately describes what you're doing and is likely to attract people's attention.

MarkMLl
MT+86 & Turbo Pascal v1 on CCP/M-86, multitasking with LAN & graphics in 128Kb.
Pet hate: people who boast about the size and sophistication of their computer.
GitHub repositories: https://github.com/MarkMLl?tab=repositories

 

TinyPortal © 2005-2018