OpenXcom Forum

Contributions => Programming => Topic started by: Callahan on March 21, 2018, 11:34:39 am

Title: Newbe needs info on where to find what in code
Post by: Callahan on March 21, 2018, 11:34:39 am
Hi all !

I seek to disable the "mutual sighting" code that prevents reaction fire if the actor does see the spotter, as this is not part of the original engine in my DOS versions of UFO/TFTD.
Now the code can be quite confusing if read for the first time, so please tell me where exactly this check is located in the code. That would save me big time searching and figuring what does what.
This one is really important to me.

Secondly, I want to rework the resource loading to store only the path of extra sprites and music/sounds in a dynamic char array, to be able to quick load them when they get used only.
The piratez mod does use way too much memory for my system and there is no need for all stuff to be loaded at game day 1.
This way, I could get any mod running, no matter the size.

Thanks for any help.
Title: Re: Newbe needs info on where to find what in code
Post by: Meridian on March 21, 2018, 12:59:26 pm
I seek to disable the "mutual sighting" code that prevents reaction fire if the actor does see the spotter, as this is not part of the original engine in my DOS versions of UFO/TFTD.
Now the code can be quite confusing if read for the first time, so please tell me where exactly this check is located in the code. That would save me big time searching and figuring what does what.
This one is really important to me.

I will answer this later, first I need to understand what you're talking about... still need to do some reading in the other thread.

Secondly, I want to rework the resource loading to store only the path of extra sprites and music/sounds in a dynamic char array, to be able to quick load them when they get used only.
The piratez mod does use way too much memory for my system and there is no need for all stuff to be loaded at game day 1.
This way, I could get any mod running, no matter the size.

Thanks for any help.

I am very skeptical about the performance, and even feasibility, of this approach.
1. loading each sprite only when needed will bring the application to a crawl
2. pre-determining (and pre-caching) what sprites are really needed (e.g. at a start of a mission) is basically impossible
3. figuring out what can be removed from memory (e.g. after mission ends) can also be very tricky... and without it, your cache would quickly grow to full size

But maybe you have just some specific stuff in mind (e.g. ufopedia backgrounds only)... that falls into the realms of "doable".

As for help... the paths to resources are already mostly available:
I did a screen recently where you can see some sprite and sound resource paths (see attachment).

Relevant code for what you see on the screenshot is here:
https://github.com/MeridianOXC/OpenXcom/blob/oxce3.5-plus-proto/src/Ufopaedia/StatsForNerdsState.cpp#L1108
and here:
https://github.com/MeridianOXC/OpenXcom/blob/oxce3.5-plus-proto/src/Ufopaedia/StatsForNerdsState.cpp#L1142

As for the place, where the sprites and sounds are loaded now, it's in Mod.cpp:
https://github.com/MeridianOXC/OpenXcom/blob/oxce3.5-plus-proto/src/Mod/Mod.cpp#L3604

Good luck.
Title: Re: Newbe needs info on where to find what in code
Post by: The Reaver of Darkness on March 21, 2018, 03:12:12 pm
You want to disable mutual surprise? I don't think openxcom has anything to do that, but if it does, Meridian would know about it.

But the old X-Com did have mutual surprise. When you see the alien and they see you at the same time, whether it's your turn or theirs, reaction fire is suppressed. This is functionality from vanilla X-Com. I've played a few old versions but I don't think I have played one without mutual surprise.

There is an old discussion on the topic, however they hadn't discovered or reached a proper solution.
Disabling mutual surprise rule (https://openxcom.org/forum/index.php?topic=2992.0)


I can think of another solution to make it easier to live with mutual surprise. Of course you can avoid letting your own soldiers take advantage of it if you wish, by going around corners without strafing. But you can also use corners to prevent aliens from gaining mutual surprise. Openxcom enables you to sidestep around a corner, but the aliens will never do this. There are some positions in which the aliens will never get mutual surprise against you.


P.S.: This post belongs in the Help forum.
Title: Re: Newbe needs info on where to find what in code
Post by: Callahan on March 21, 2018, 04:21:29 pm
Well, to tell the thing about "mutal surprise" as I see it, I tell you a short story of "Lucky Luke", the soldier with 100+ reaction who is faster than his shadow.

I'd like to mention that I use to play DOS xcom 1/2/3 with reaction fire only for years now, so I got alot of experience with that DOS reaction stuff.

In DOS, Lucky Luke and 3 fellows guard a UFO door from ahead, no blind angle. Alien opens the door and gets shot by one or more of Lucky Luke's squad instantly. Works every single time with reactions high enough.
Just tested this again yesterday to be sure about it.
I would bet it was the same in my DOS TFTD. I will edit some soldiers to super stats and make qick test of this today, by placing a few soldiers in plain sight of a alien sub door.

Now in open xcom, the story develops otherwise. Lucky Luke points his gun toward the UFO door, it opens, and an ARMED, HOSTILE????? Alien steps out. Now Lucky Luke and his squad are completely puzzled, he expected Ghandi to step out and invite him over to a cup of tea. And while Mr. Luke is still pondering this thought, a Sectiod with whimpy 26 Reaction rating is blasting him to hell.
Every damned single time without any chance for him to shoot faster than Mr. "Sloooow" Sectiod.

In my DOS UFO, reaction was a way to take away the initiative from an enemy, in open xcom it is merely just a factor for how fast you retaliate an attack.
"Mutual" surprise should mean the one with higher score does act first, but open xcom always favours the side who has it's turn.

Thanks for all the links, Meridian. That's alot to learn for me.
For the resources, I do not think I will fill up RAM that quickly. Most of the stuff, guns, armors, are not available at start.
I use to have a blitter function like this in all of my programs:

if ( !pSurface)
LoadSurface() ;
if ( !pSurface)
return; //Failed

Blt(..) ;

Of course RAM is filled over time, but only with stuff you actually use. That gives you a speed and RAM efficiency boost at programm start and a few tiny delays while stuff is loaded as needed.
Mostly, when loading smaller bitmaps, I do not even notice any delay, and my system is ancient. (2001)
Title: Re: Newbe needs info on where to find what in code
Post by: Meridian on March 21, 2018, 05:08:25 pm
I seek to disable the "mutual sighting" code that prevents reaction fire if the actor does see the spotter, as this is not part of the original engine in my DOS versions of UFO/TFTD.
Now the code can be quite confusing if read for the first time, so please tell me where exactly this check is located in the code. That would save me big time searching and figuring what does what.
This one is really important to me.

I can't say for sure how it worked in the original... I asked Warboy... maybe he will remember and will shed some light on the internal organs of vanilla.

In the meantime, this is the function that checks for reaction fire:
https://github.com/MeridianOXC/OpenXcom/blob/oxce3.5-plus-proto/src/Battlescape/TileEngine.cpp#L1665

It is called from all places listed in: https://www.ufopaedia.org/index.php/Reaction_fire_triggers

Opening doors is (besides other places!) part of walking state:
https://github.com/MeridianOXC/OpenXcom/blob/oxce3.5-plus-proto/src/Battlescape/UnitWalkBState.cpp#L335

And it is done AFTER the reaction checks:
https://github.com/MeridianOXC/OpenXcom/blob/oxce3.5-plus-proto/src/Battlescape/UnitWalkBState.cpp#L214

Now this doesn't mean it's wrong, the state's think() method is called many many times, so it might be the next call of this method that is supposed to process it... or not, depending on Warboy's answer to the original question.

I can't tell you where would be the best/correct place to put reaction checks for Lucky Luke...
... I put it in the place as shown on the screenshot, and Lucky Luke did shoot before a floater who just opened the door could say "we come in peace".

I recommend carefully studying the code before you decide to make the change... take my example only as inspiration, there's a 99% chance it's not complete and 75% chance it's wrong :)

Thanks for all the links, Meridian. That's alot to learn for me.
For the resources, I do not think I will fill up RAM that quickly. Most of the stuff, guns, armors, are not available at start.
I use to have a blitter function like this in all of my programs:

if ( !pSurface)
LoadSurface() ;
if ( !pSurface)
return; //Failed

Blt(..) ;

I know what you mean.

You'll understand what I mean after you read the code... everything's doable, some things are just not worth the effort. You may be able to find a feasible compromise though... let us know when/if you do.
Title: Re: Newbe needs info on where to find what in code
Post by: Callahan on March 21, 2018, 07:21:11 pm
Meridian, I really have to say I grow to love your answers. Perfectly on point, containing all the info regarding the topic with precision and even offering a solution to help understand the mechanics. Just amazing, honestly.

As for the learning curve: I sometimes even have problems to understand my own code after a while.
This will be learning by doing a lot.
By the way, do I need some stuff other than the source for compiling this? DLLs, some DirectX SDK, other things to include?
I'm still looking for a compiler that does on my system. My old C++ cannot even read the project file.
I expected a .dsw/.dsp format, but I'm probably stone age with that.

As for the internal organs, I just tested DOS TFTD, and the aliens did all die on exiting the subs in rain of bullets. If Warboy does just play a bit of xcom 1 & 2 in reaction fire only mode, there will qickly be some light shed on the differences between vanilla and open xcom.

And... just as a side note: Are the aliens no longer fireing at the furniture on attacking player bases?
I remember to have lost a few workshops in vanilla that way.

EDIT: Had a brainstorm. While I am trying to find/setup a compiler, and since you test compiled the "Lucky Luke" experimental exe - could I have it in 32 bit version? Incomplete and 75% wrong sounds quite seductive to me right now.
Title: Re: Newbe needs info on where to find what in code
Post by: Meridian on March 21, 2018, 07:52:17 pm
Meridian, I really have to say I grow to love your answers. Perfectly on point, containing all the info regarding the topic with precision and even offering a solution to help understand the mechanics. Just amazing, honestly.

Thx.

As for the learning curve: I sometimes even have problems to understand my own code after a while.
This will be learning by doing a lot.
By the way, do I need some stuff other than the source for compiling this? DLLs, some DirectX SDK, other things to include?
I'm still looking for a compiler that does on my system. My old C++ cannot even read the project file.
I expected a .dsw/.dsp format, but I'm probably stone age with that.

You need the following dependencies: https://www.ufopaedia.org/index.php/Compiling_(OpenXcom)#Dependencies

If you're using Visual Studio, pre-compiled dependencies for 2010, 2013, 2015 and 2017 are here: https://www.ufopaedia.org/index.php/Compiling_with_Microsoft_Visual_C%2B%2B_(OpenXcom)#Compiling_.28x32_Release.29

As for the internal organs, I just tested DOS TFTD, and the aliens did all die on exiting the subs in rain of bullets. If Warboy does just play a bit of xcom 1 & 2 in reaction fire only mode, there will qickly be some light shed on the differences between vanilla and open xcom.

I didn't mean "remembers from playing"... I meant "remembers from reading the decompiled code"... Warboy (and a few others) decompiled the entire original xcom and implemented OpenXcom (also) based on that.

And... just as a side note: Are the aliens no longer fireing at the furniture on attacking player bases?
I remember to have lost a few workshops in vanilla that way.

Yes, they do still fire at "base furniture" in OpenXcom :)
Btw. I know that only from reading the code... I never ever lost a facility in original xcom due to that... first time was in OpenXcom.

EDIT: Had a brainstorm. While I am trying to find/setup a compiler, and since you test compiled the "Lucky Luke" experimental exe - could I have it in 32 bit version? Incomplete and 75% wrong sounds quite seductive to me right now.

Sure, give me a moment.

--- posts merged. No one is safe! ---

Try this: 2018-03-21-OpenXcomExPlus-LuckyLukeEdition.zip (https://drive.google.com/open?id=1QIoIB32ium49D5eTBQM-ISqWp6XKLRgM)
Title: Re: Newbe needs info on where to find what in code
Post by: The Reaver of Darkness on March 21, 2018, 10:57:20 pm
In DOS, Lucky Luke and 3 fellows guard a UFO door from ahead, no blind angle. Alien opens the door and gets shot by one or more of Lucky Luke's squad instantly. Works every single time with reactions high enough.
According to your experience, the aliens did not incur mutual surprise against the player.
According to my experience, the player did incur mutual surprise against the aliens.

I think we can see how it must have worked. In openxcom (OXC), the big difference is that both sides get mutual surprise, instead of it just being the player benefiting in both cases. I think I agree with you here, mutual surprise is a bad idea. It was useful to use against the aliens in the original, since their reaction attribute was so absurdly high they would often drain their entire time unit bar reacting to a single move when your soldier has full time units. Also, the original reactions training only worked if you waited for the aliens to come to you. So it made sense for the player to benefit in both cases; anything else would have made the game unreasonably difficult.

But while I think mutual surprise is a bad idea, I think it was also a bad idea to give the aliens such high reactions. It leads to the player losing 3+ soldiers from unseen aliens just from exiting the craft on a terror mission unless they wait inside on the first turn--which works because the aliens don't use grenades on the first turn, but it's completely counter-intuitive.

To really fix it, you have to change at least three things:
1.) remove mutual surprise
2.) reduce alien reaction attributes to be similar to humans (most importantly earlier aliens)
choice--one or both:
3a.) enable soldiers to train reactions by suppressing reaction fire as well as by using it
3b.) increase alien time units--their AI in OXC is very similar to vanilla AI, until you raise their TUs high enough to get to the next node, then suddenly they come out of hiding and try to attack you


- - - -

It would be awfully neat if OXCE+ had two new global variables:

friendlyMutualSurprise: true
enemyMutualSurprise: true
Title: Re: Newbe needs info on where to find what in code
Post by: Callahan on March 22, 2018, 11:38:31 am
Making the reaction system switchable is a must. There is no point in forcing anyone to play the one or other style. I would dump mutual surprise, as it  negates reaction in many a combat situation, but it is not everyones opinion.

As for turn 1, I always had in mind cutting the aliens initial TUs by some % to simulate arriving "during action". That should do for turn 1 without tampering with the vanilla alien stats.

Thanks for the exe, Meridian, as well as the explanations. Cool thing they managed to reverse engineer DOS xcom. I was always bound to observation of the game itself. I will try the Luky Luke edition as soon as I have hex edited it to work in Win 2000.
Title: Re: Newbe needs info on where to find what in code
Post by: Meridian on March 22, 2018, 11:43:53 am
It would be awfully neat if OXCE+ had two new global variables:
friendlyMutualSurprise: true
enemyMutualSurprise: true

No.

Making the reaction system switchable is a must.

No.

PS: can you upload a vanilla save where I can test this behavior? I tried a bit, but I don't have soldiers with high enough reactions...
Title: Re: Newbe needs info on where to find what in code
Post by: Callahan on March 22, 2018, 04:16:53 pm
Here is a vanilla savegame with some good soldiers. I had to copy them outta my tactical savegame into a newly started one, so don't be confused over them to be like that on day 1.
Should work in spite of the little cheat.

With those guys, you will see enemies left in your soldiers view at end of turn to be shot before they can take any action.
Title: Re: Newbe needs info on where to find what in code
Post by: The Reaver of Darkness on March 22, 2018, 09:10:25 pm
How do I use this folder as a save game? It's not in the same format.
Title: Re: Newbe needs info on where to find what in code
Post by: Meridian on March 22, 2018, 10:12:17 pm
How do I use this folder as a save game? It's not in the same format.

Well, first, it's an xcom1994 save, not an OpenXcom save... but I assume you knew that?
It loads fine in xcom1994.

OpenXcom can load xcom1994 geoscape saves too... but only if they are 100% correct... this one was hexedited (or otherwise tempered with) and is slightly corrupted (contains soldiers that belong to non-existing bases)... so OpenXcom crashes when it tries to load it.
Title: Re: Newbe needs info on where to find what in code
Post by: Callahan on March 23, 2018, 10:41:55 am
Well, first, it's an xcom1994 save, not an OpenXcom save... but I assume you knew that?
It loads fine in xcom1994.

OpenXcom can load xcom1994 geoscape saves too... but only if they are 100% correct... this one was hexedited (or otherwise tempered with) and is slightly corrupted (contains soldiers that belong to non-existing bases)... so OpenXcom crashes when it tries to load it.

Guess I should have tested for that before. I will fix it.

Ran into trouble. Not for love or money I can load any vanilla save. Not even a fresh one from a fresh DOS install. Open xcom tells me something would be missing in my mod, but no word on what this might be in the log.
So I had to apply a fix by blind snapshot. Deleted all soldiers that may caused trouble. No idea if that does it. I'm unable to test that.
Title: Re: Newbe needs info on where to find what in code
Post by: Meridian on April 01, 2018, 03:24:39 pm
So after testing and investigating, I admit there is a yet-unidentified difference between OG and OpenXcom.

It is however beyond my current capabilities to find out what exactly it is.

PS: the difference is NOT in opening doors triggering reaction fire; and most likely also not in mutual surprise... it is very likely something very subtle that has quite big impact
PS2: that means that my "LuckyLuke experiment" was 100% wrong... although still might cover your taste :)
Title: Re: Newbe needs info on where to find what in code
Post by: Callahan on April 01, 2018, 07:45:54 pm
Thanks for testing this thoroughly. From my personal experience, I would not say the Lucky Luke experiment is 100% wrong. The only difference I noticed was that the alien does not pass through the door before being shot at. So I still think you got very close to the "door situation" regarding the result.

The most interesting part of all this is that there actually is something that was previously unknown.

I will try to join testing by altering the code to what I believe is happening in vanilla, but I have to put together a new PC from the spare parts in my basement to get visual studio 2010 running.
Title: Re: Newbe needs info on where to find what in code
Post by: Callahan on April 03, 2018, 01:58:58 pm
I finally got VS 2010 working, but ran into a new issue. I got a compiler error "platformtools v141 not installed".
This platformtool thing is new to me. Where can I find :
A: The v141 platformtool download or install
B: What version I currently have to change the used version in the project to what I have.
Title: Re: Newbe needs info on where to find what in code
Post by: Meridian on April 03, 2018, 02:11:14 pm
Did you get this on OpenXcom or on OXCE+ ?
You should not get this for OpenXcom as far as I know...

--

The "OpenXcom.2010.vcxproj" in OXCE+ is actually for VS2017.

But you can downgrade to VS2010 by deleting the following lines (potentially multiple times):

Code: [Select]
<WindowsTargetPlatformVersion>8.1</WindowsTargetPlatformVersion>

Code: [Select]
<PlatformToolset>v141</PlatformToolset>

There's still a high chance it will not work at the end because OXCE+ needs C++11 support... I don't know how much of it VS 2010 actually has.

If you got VS2010 running, I guess you're able to run VS2017 too... which I would highly recommend, it's quite a lot better and also faster... and free (Community Edition).
Title: Re: Newbe needs info on where to find what in code
Post by: Callahan on April 03, 2018, 03:44:49 pm
Thanks for the advice.
I got your OXCE 3.5 proto code. I want the good stuff.
I've set the toolset to some lower value, but now I get 100+ syntax errors. Does not seem to be downgradeable without a hacksaw.
VS 2017 states to need Win 7 minimum. We shall see.
Title: Re: Newbe needs info on where to find what in code
Post by: Meridian on April 03, 2018, 03:50:00 pm
VS2015 should work too... don't know if that helps... lower versions most likely not.
Title: Re: Newbe needs info on where to find what in code
Post by: jgatkinsn on April 03, 2018, 05:51:20 pm
I got your OXCE 3.5 proto code. I want the good stuff.

Well said ;)
Title: Re: Newbe needs info on where to find what in code
Post by: Callahan on April 03, 2018, 06:03:09 pm
2015 does also need Win 7 minimum. I even tried with a Win 7 virtual HD I got from the web, but no luck.
This is so frustrating. My computers where almost new back when I bagged them from the community junkyard. I will have to lookaround for some newer model PC.

In the meantime, I have another question. I took a look into those .rul files. OXC is customizable in an astonishing number of ways. Is there a way to tie weapon damage to completed research?
In detail I wondered if it was possible to give all those alien autopsy research some profit in making gunfire against some units more damaging after autopsy has been researched.
Title: Re: Newbe needs info on where to find what in code
Post by: Meridian on April 03, 2018, 06:09:12 pm
In detail I wondered if it was possible to give all those alien autopsy research some profit in making gunfire against some units more damaging after autopsy has been researched.

No, not directly like that.

The closest thing I can think of is have 2 versions of the alien unit/armor... with different damage resistances.
And once the research is completed, the "weaker" aliens would start showing up next month... mission scripts can depend on research triggers.

It might be a considerable amount of repetitive work tho.
Title: Re: Newbe needs info on where to find what in code
Post by: Callahan on April 03, 2018, 06:21:00 pm
That sounds like it would work. I'll take a look at the mission scripts to get an understanding of the matter. Thanks.
Title: Re: Newbe needs info on where to find what in code
Post by: jgatkinsn on April 03, 2018, 06:48:08 pm
2015 does also need Win 7 minimum. I even tried with a Win 7 virtual HD I got from the web, but no luck.
This is so frustrating. My computers where almost new back when I bagged them from the community junkyard. I will have to lookaround for some newer model PC.


If you're somewhat familiar with Linux,  you could take one of those old computers and put a free version of Ubuntu 16.04 on it.  OXCE+ (and OXC) work great on Linux, and Ubuntu should perform fairly well on older systems and installs pretty easily.   The compile instructions work pretty well other than having to install a speciific version of yaml-cpp library that is is broken in 16.04.  If you're interested, you can message me more about getting it compiled on Linux with the yaml-cpp fix.
Title: Re: Newbe needs info on where to find what in code
Post by: Callahan on April 03, 2018, 07:28:53 pm
I would need an OXCE that runs on my windows computer. As far as I understand ubuntu, it is not possible to compile executables for windows 32bit with it. If that would be possible it could be a solution.
Especially if ubunto works on a virtual machine.
Title: Re: Newbe needs info on where to find what in code
Post by: jgatkinsn on April 03, 2018, 07:36:16 pm
I would need an OXCE that runs on my windows computer. As far as I understand ubuntu, it is not possible to compile executables for windows 32bit with it. If that would be possible it could be a solution.
Especially if ubunto works on a virtual machine.

Yes, ubuntu runs on a VM :)  You can compile for windows 32bit using mingw32 as a "cross-compiler" on Linux, but it would be more work than building native Linux.  If you want to go that route, you can use a shared folder between the VM and your host system to build the code and share it to the host.  You can also use mingw32 on windows to build Windows programs as well (also more work than using Visual Studio) but might help you past some Visual Studio issues you're fighting.  I guess my original suggestion was actually compiling it and running it on Linux :)
Title: Re: Newbe needs info on where to find what in code
Post by: ohartenstein23 on April 03, 2018, 07:37:00 pm
I think the MXE build chain in Ubuntu allows you to make 32-bit windows executables, I've been using that when I need to make a windows build for testing.
Title: Re: Newbe needs info on where to find what in code
Post by: Yankes on April 03, 2018, 07:39:36 pm
Use MinGW that crease small compatible layer that allow running GCC and other Linux tools.
Overall my tool for work is GCC under windows and do not need VS for compiling and running OXC on windows.
Title: Re: Newbe needs info on where to find what in code
Post by: Meridian on April 03, 2018, 07:52:56 pm
I would need an OXCE that runs on my windows computer. As far as I understand ubuntu, it is not possible to compile executables for windows 32bit with it. If that would be possible it could be a solution.
Especially if ubunto works on a virtual machine.

It is possible.
I am actually also compiling Windows release versions on an Ubuntu 16.04 VM with MXE... based on steps Yankes published somewhere.

I use VS2017 for coding and debugging... but build a final release under Linux.

PS: also OpenXcom nightlies are built that way afaik
Title: Re: Newbe needs info on where to find what in code
Post by: Callahan on April 04, 2018, 11:34:24 am
I am currently trying to get a PC from one of my friends. I would prefer that over Linux. Nothing against Ubuntu, but I guess it will do both of us well if this old dog does not need to learn a new trick. If that fails, however, brace yourself for a bunch of beginner questions about Linux/Ubuntu.

In the meantime, I did ponder Meridians test results on the reaction fire issue and had an enlightenment.

the difference is NOT in opening doors triggering reaction fire; and most likely also not in mutual surprise... it is very likely something very subtle that has quite big impact

Perfectly on point. Meridian is right.

PS2: that means that my "LuckyLuke experiment" was 100% wrong...

Unfortunately absolutely right, too.

A reaction fire check in vanilla is performed right before an alien does fire a gun/prime a granade. That does explain just everything:
Aliens shot by reaction fire on their tile without moving, fireing or doing something else.
Aliens shot inside UFO when door is blocked when they open it.
Seemingly no mutual surprise for aliens. (They are seen to get shot)

This reaction check does only apply to aliens in vanilla.

So if we would move the "Lucky Luke" experimental reaction code to the spot right before an Alien does fire or prime a grenade, we will have a reaction system identical to vanilla x-com 1 & 2.
Title: Re: Newbe needs info on where to find what in code
Post by: Yankes on April 04, 2018, 10:22:20 pm
I am currently trying to get a PC from one of my friends. I would prefer that over Linux. Nothing against Ubuntu, but I guess it will do both of us well if this old dog does not need to learn a new trick. If that fails, however, brace yourself for a bunch of beginner questions about Linux/Ubuntu.
You do not need Linux to rung GCC/MinGW there is 5% chance that you already have all tools if you downloaded Git for Windows: https://git-scm.com/download/win
As I said previously it contains minimal compatibility layer to work with linux-based software on Windows (like Git, GCC, bash, OXCE).

Title: Re: Newbe needs info on where to find what in code
Post by: Callahan on April 05, 2018, 11:13:54 am
Git does need Windows Vista minimum. I'll try again as soon as I get a newer PC running. Currently I have got 3 used PCs from my friend, but with all of them my monitor tells me "No input signal". Not even with the onboard graphics. No idea what's wrong with them. I seem to have a streak of bad luck.

But many thanks for all the help. I really appreciate the effort.

And I found another thing to fix in OXC. Group attacks on UFOs lead to the UFO always fireing on the first fighter. Vanilla fires at a random fighter.
Title: Re: Newbe needs info on where to find what in code
Post by: Yankes on April 05, 2018, 05:25:10 pm
Git does need Windows Vista minimum.
crap, maybe older version: https://sourceforge.net/projects/mingw/files/Installer/mingw-get-setup.exe/download will work for you?

[ps]
or https://sourceforge.net/projects/mingw-w64/files/Toolchains%20targetting%20Win32/Personal%20Builds/mingw-builds/installer/mingw-w64-install.exe/download
Title: Re: Newbe needs info on where to find what in code
Post by: Callahan on April 05, 2018, 08:21:30 pm
Perfect. That went well. The second link worked.
I am now proud owner of "7.3.0 posix dwarf rt v5 rev0 files".

Thanks for the help, Yankes. I was in desperate need of something to work at last. Today afternoon I attempted to get one of my "new" used PCs to work and, unbelievably, it cought fire. More precise the power supply unit cought fire. Now I'm surrounded by the sweet smell of molten capacitors and my mood had hit a new low.

But now I see a silver lining.
What will be the next step/where can I learn how to compile OXCE source code using "mingw-w64" ?
Title: Re: Newbe needs info on where to find what in code
Post by: jgatkinsn on April 05, 2018, 08:58:54 pm
But now I see a silver lining.
What will be the next step/where can I learn how to compile OXCE source code using "mingw-w64" ?

I don't know how accurate it is, but it should be fairly close...

https://www.ufopaedia.org/index.php/Compiling_with_MinGW_(OpenXcom)
Title: Re: Newbe needs info on where to find what in code
Post by: Yankes on April 06, 2018, 12:20:19 am
As base you can use this file https://github.com/Yankes/OpenXcom/blob/OpenXcomExtended/src/Makefile.mingw (shroud be included in your src uif you grab code of OXCE).
You need SDL libs data (from jgatkinsn link) and src code of yaml-cpp https://github.com/jbeder/yaml-cpp
You will need adjust paths in makefile to match your mingw config.
Then you call make and you should get new exe in bin folder.

(btw you can remove `SRCS_BOOST = ../../lib/boost/`parts becasue new yaml-cpp do not use boost any more)
Title: Re: Newbe needs info on where to find what in code
Post by: Callahan on April 06, 2018, 03:36:57 pm
I've got a lot of problems getting the MinGW compiler. The mingw-get-setup.exe says the path to stuff to install is wrong, and manual download failed with the message:
The "/MinGW/Base/binutils..mingw32-bin.tar.lzma" file could not be found or is not available. Please select another file.

Other file links failed to download, too.
Only this:
https://sourceforge.net/projects/mingw-w64/files/Toolchains%20targetting%20Win32/Personal%20Builds/mingw-builds/installer/mingw-w64-install.exe/download
Installed properly, but my C:\MinGW folder is almost empty, executing a makefile does nothing but a Windows dialogue "Choose program to open file with".

How to get MinGW compiler if both the installer and the manual download links are dead?
The SDL and Yaml-cpp stuff is added to my project, but I cannot execute a "Makefile" with the MinGW stuff I got from Yankes second "MinGW-w64" link.

Second question: If I open a makefile in my notepad, it is just a blur of text and squares. What programm is best used to open and edit a "Makefile"?.
Title: Re: Newbe needs info on where to find what in code
Post by: Yankes on April 06, 2018, 04:28:22 pm
I will prepare exactly steps to compile OXCE using mingw-w64.
Title: Re: Newbe needs info on where to find what in code
Post by: Callahan on April 06, 2018, 05:02:32 pm
Thanks. And sorry for the inconvenience.
I seem to be a fusion of lack of knowledge with lack of luck.
Just ran your MinGW-w64 install link a second time, and now I have some new stuff, including a "mingw32-make.exe". The previous install merely consisted of a "mingw-64.bat" and a "Lib" folder.
I'll now try to use the new -make.exe with the command line instructions from the OXC help page.
Title: Re: Newbe needs info on where to find what in code
Post by: jgatkinsn on April 06, 2018, 05:06:16 pm
Second question: If I open a makefile in my notepad, it is just a blur of text and squares. What programm is best used to open and edit a "Makefile"?.

Something is wrong with the file you opened, because it sounds like you opened a binary file.  Makefiles are pure text, so any text editor will do.  When the MingGW gets installed properly and your paths are setup correctly, you should have a file called "make"  or "mingw32-make.exe" in the path of your Windows system that is a binary executable.  You call this executable in your directory where the code should have a "Makefile" or "Makefile.XXX"  located for it to read and parse to executed build commands inside it. 

Wait for Yankes instructions though before you go too far.  I thought would at least explain to you what makefiles are and how "make" runs them.
Title: Re: Newbe needs info on where to find what in code
Post by: Yankes on April 06, 2018, 05:09:45 pm
Thanks. And sorry for the inconvenience.
I seem to be a fusion of lack of knowledge with lack of luck.
Just ran your MinGW-w64 install link a second time, and now I have some new stuff, including a "mingw32-make.exe". The previous install merely consisted of a "mingw-64.bat" and a "Lib" folder.
I'll now try to use the new -make.exe with the command line instructions from the OXC help page.
I installed MinGW long time ago, and when I did this today I find some place that will be hard to you to solve.
I will prepare steps that go from zero to working exe.
Title: Re: Newbe needs info on where to find what in code
Post by: Callahan on April 06, 2018, 05:42:16 pm
Something is wrong with the file you opened, because it sounds like you opened a binary file.  Makefiles are pure text, so any text editor will do.

Something was wrong with my notepad editor. Notepad++ opens the file readable.

You call this executable in your directory where the code should have a "Makefile" or "Makefile.XXX"  located for it to read and parse to executed build commands inside it. 

I assume I would use the dos prompt for navigating there ? , as my Windows "Run" command does only allow me to choose the program, but not the location. Or do I best use a shortcut to the -make.exe with command line parameters?

P.S. Just read that on creating the yaml-cpp thing I shall execute:
cmake -G "MinGW Makefiles" -DBUILD_SHARED_LIBS=OFF -DBoost_INCLUDE_DIR=<project>\boost_1_54_0 ..
But my MinGW/Bin does lack a cmake file or .exe. Is that another file missing during install, or is the instruction invalid for using MinGW-w64?

PPS. On building "mingw32-make SDL_gfx.dll" I get an error *** no rule to make target SDL_gfx.dll.
What did I screw up this time?
At least I seem to have gotten MinGW32-make.exe to do something.
Title: Re: Newbe needs info on where to find what in code
Post by: Yankes on April 06, 2018, 06:09:52 pm
Install MinGW from:
https://sourceforge.net/projects/mingw-w64/files/Toolchains%20targetting%20Win32/Personal%20Builds/mingw-builds/installer/mingw-w64-install.exe/download
To folder `C:\MinGW\`

Download `make` and it dependencies from:
https://sourceforge.net/projects/gnuwin32/files/make/3.81/make-3.81-bin.zip/download?use_mirror=kent&download=
https://sourceforge.net/projects/gnuwin32/files/make/3.81/make-3.81-dep.zip/download?use_mirror=netcologne&download=
And extract both to folder `C:\MinGW\mingw32\`

Download https://github.com/jbeder/yaml-cpp/archive/master.zip
And extract folder `yaml-cpp-master` from it to `C:\work\yaml-cpp`

Download http://bumba.net/~hmaon/oxc/OXC-mingw32-cross-tools.tar.xz
And extract folder `usr\local\cross-tools\i386-mingw32\` from it to `C:\MinGW\mingw32\`

After this open `C:\MinGW\` and run `mingw-w64.bat`.
Navigate in console to folder with openxcom or download new one using:
Code: [Select]
cd C:\
#name of folder where you want have openxcom folder, you can skip this step and move to other localization
mkdir work
cd work
#you can choose Meridian repo too if you want
git clone https://github.com/Yankes/OpenXcom.git openxcom
cd openxcom\src
Now copy file from this post attachment to `C:\work\openxcom\src` and rename it to `Makefile` (without any extension!)
And when you did this run
Code: [Select]
mkdir ..\obj\yaml
make
Now after everything is compiled you will get exe in `C:\work\openxcom\bin`
Now you only need place UFO data in correct place.

[PS]
If you use diffrent folders you need alter `Makefile` becasue it have hardcoded paths, they need match with what you have.
Title: Re: Newbe needs info on where to find what in code
Post by: jgatkinsn on April 06, 2018, 06:32:38 pm
Something was wrong with my notepad editor. Notepad++ opens the file readable.

Not surprised, Notepad is probably the worst text editor ever created :)

Quote
I assume I would use the dos prompt for navigating there ? , as my Windows "Run" command does only allow me to choose the program, but not the location. Or do I best use a shortcut to the -make.exe with command line parameters?

Dos prompt.

Title: Re: Newbe needs info on where to find what in code
Post by: Callahan on April 06, 2018, 07:12:50 pm
Almost there. A very good guide, Yankes!
It would compile, but says "SDL.H" was not found when it tried to include it.
I tried to download the SDL 1.2 for MinGW32 and the other stuff from the OXC help page and added the folders to the project, but either I downloaded the wrong things or placed them in the wrong position.
OK, I got the right location of SDL.
Next is yaml-cpp/yaml.h not being found. It is placed in "C:\work\yaml-cpp"
According to makefile, this is the right place. What am I missing?


Strike that, too. I should have taken the content of yaml-cpp Master into yaml-cpp, but I copied the folder.
Now it does compile. In a few Minutes I will know if it was sucessfull

Yankes, your guide should replace the old one at
https://www.ufopaedia.org/index.php/Compiling_with_MinGW_(OpenXcom)
You are 75% faster and equally less complicated.
Title: Re: Newbe needs info on where to find what in code
Post by: Yankes on April 06, 2018, 08:50:27 pm
Great, I will add my guide there for other to use.
Title: Re: Newbe needs info on where to find what in code
Post by: Callahan on April 06, 2018, 09:30:37 pm
It compiled the openxcom.exe. I will compress and upload the composed MinGW and "work" folder for anyone as ready to use download to insert any OXC code the next few days. Just in case some of those download links become dead in the future.

I'll now test the exe by playing, but I have to overwrite a few things in hex editor to make it work in my Win 2000, as OXC does not normally support that OS. I'll report back here tomorrow if it is playable.

Then I can turn my attention to the code itself. I'll write in Notpad++ and compile it in MinGW.
Will take a while until I figure out what all the new C++ expressions do. The syntax is quite different from my old C++ 6.
Many thanks for all your help and patience.

Title: Re: Newbe needs info on where to find what in code
Post by: Yankes on April 06, 2018, 10:23:36 pm
It compiled the openxcom.exe. I will compress and upload the composed MinGW and "work" folder for anyone as ready to use download to insert any OXC code the next few days. Just in case some of those download links become dead in the future.

I'll now test the exe by playing, but I have to overwrite a few things in hex editor to make it work in my Win 2000, as OXC does not normally support that OS. I'll report back here tomorrow if it is playable.

Then I can turn my attention to the code itself. I'll write in Notpad++ and compile it in MinGW.
Will take a while until I figure out what all the new C++ expressions do. The syntax is quite different from my old C++ 6.
Many thanks for all your help and patience.
You can check out if NetBeans work on your machine (is based on Java), it have support for 99% thing that is used in OXCE code.
It have support for MinGW compiling and gdb debugging.

btw what you did chane in exe to run in in Win2k?
btw2 I updated https://www.ufopaedia.org/index.php/Compiling_with_MinGW_(OpenXcom) with my guide for runing it
Title: Re: Newbe needs info on where to find what in code
Post by: Callahan on April 07, 2018, 12:16:16 pm
To get OXCE work on my win 2000, I just butchered the exe as well as several DLLs into submission.

OXCE checks for several DLLs in Windows/system32. While it is unhealthy to just copy DLLs from WinXP SP3 to Win2000, you can hex edit the exe to look for the DLLs in the wrong spot, or for a wrong filename (easiest). A fallback is then executed to look for the missing DLLs in the installation folder.
Then download the DLLs that are looked for in their WinXP SP3 version and put them into installation folder.

Next you have to hex edit those DLLs inside the installation folder to prevent themselves to look for other DLLs in Windows/system32. A wrong name works well here, too. Again a fallback is executed and the DLLs from the installation folder are used.
Once the DLLs are setup properly, one has only to edit the exe in case it is replaced.
This procedure completely bypasses the installed windows version.
It is possible this would work even down to Win95, but may require additional DLLs to be butchered. I'll test that in a quiet minute on one of my really old machines.

The new guide is great. This makes things a whole lot easier especially for people who have zero experience with MinGW compilers. Well done.

EDIT
There are a lot of differences to the exe I got from Meridian/the Piratez mod.

My exe is 17 MB instead of 11 MB, does check for additional DLLs, and does not have the alien head icon, but dos prompt icon.
I used OXCE 3.5 plus proto code from here:
https://github.com/MeridianOXC/OpenXcom/tree/oxce3.5-plus-proto
Does this difference result from different code, the compiler itself, or the makefile?
Title: Re: Newbe needs info on where to find what in code
Post by: Yankes on April 07, 2018, 03:09:57 pm
one diffrence is that you compiled my branch OXCE and Meridian have OXCE+ it have more features than my branch. You can use same setup to compile his version.
adding exe icon is separate step that is not included in my guide because is not critical part.
size of exe is cause what type of compilation is used, exe from Piratez is in release mode and my makefile create debug mode, you can change this altering `CXXFLAGS ?= -Og` line.
Title: Re: Newbe needs info on where to find what in code
Post by: Callahan on April 07, 2018, 03:52:37 pm
Thanks for the explanation. Every bit of this is quite new to me. As if I had just started programming....
And I am a bit confused over the branch used, as I used the OXCE 3.5 PLUS proto. This should have been Meridians version.
To what would I have to alter the "CXXFLAGS ?= -Og" line for a smaller release version?

I also had a bit of trouble with the syntax. It seems to rely heavily on objects. Not my strong side.
Nevertheless I changed the reaction fire system and it does now seem to be identical to DOS XC 1 & 2.
Further tests will be made by me to confirm this.
Next I'll try to make it load extra images/sprites only just before they are used. That will enable me to run the monster mod on my wimpy system.
Do you know where the function of loading the defined extra sprites/images is located?
I would also like to take a look at the function that does execute the blit on screen.
Is this just 1 function, or does geoscape and ufopedia use other blitters than battlescape?
Title: Re: Newbe needs info on where to find what in code
Post by: Yankes on April 07, 2018, 04:23:42 pm
Majority of blits is done using `Surface::blitNShade` in battlescape.
And loading by `Mod::loadVanillaResources` and some others functions.
Title: Re: Newbe needs info on where to find what in code
Post by: Callahan on April 07, 2018, 06:38:54 pm
Very good, thanks. You saved me alot of time browsing every CPP file.
That will give me a point from where to start understanding how it works.
Title: Re: Newbe needs info on where to find what in code
Post by: Callahan on April 08, 2018, 07:04:05 pm
@Meridian.
Do you use some special makefile for compiling the OXCE 3.5 plus proto code?

I tried with several of the makefiles contained in the download as well as all CXXFLAGs from -O0 to -Og, but my exe does not shrink below 16.7 MB. Your Lucky Luke exe was only 11 MB. How did you achieve that?
Title: Re: Newbe needs info on where to find what in code
Post by: Meridian on April 08, 2018, 07:27:16 pm
@Meridian.
Do you use some special makefile for compiling the OXCE 3.5 plus proto code?

I tried with several of the makefiles contained in the download as well as all CXXFLAGs from -O0 to -Og, but my exe does not shrink below 16.7 MB. Your Lucky Luke exe was only 11 MB. How did you achieve that?

I use makefile.mxe from Yankes:

Details attached here: https://openxcom.org/forum/index.php/topic,2915.msg61137.html#msg61137

https://github.com/MeridianOXC/OpenXcom/blob/oxce3.5-plus-proto/src/Makefile.mxe

PS: don't know what the difference could be... maybe you have older version of yaml-cpp which still has Boost...
Title: Re: Newbe needs info on where to find what in code
Post by: Callahan on April 08, 2018, 07:43:57 pm
Thanks, that's an interesting discussion.
I got yaml-cpp from here:
https://github.com/jbeder/yaml-cpp/archive/master.zip
No idea if this is a version with/without boost. I'm totally new to yaml and MinGW.

I'll also try if I can get this MXE build chain to work in my windows.
I'm really jealous. Your work is so small and elegant, while I feel like a bull in a china shop with my oversized and cumbersome build. I still need to learn alot more.
Title: Re: Newbe needs info on where to find what in code
Post by: Meridian on April 08, 2018, 08:01:58 pm
Master yaml-cpp is without Boost, since 2016 or so... so that wouldn't be an issue.

Maybe because you're doing a "debug build" instead of a "release build"?
Title: Re: Newbe needs info on where to find what in code
Post by: Yankes on April 09, 2018, 01:28:51 am
@Callahan try use `-O3  -s` and probably more immorality size of exe is irrelevant, i have 500MiB exes when build local debug... and it still work fine.
Simply different lib set could make it too, as long everything work fine, difference in size should be ignored.
Title: Re: Newbe needs info on where to find what in code
Post by: Callahan on April 09, 2018, 12:43:29 pm
Confusing. Using O3 -s increased the size of the exe by 0.3 MB.
Dissecting the exe, I found the main trouble to be "AddVectoredExceptionHandler" and "RemoveVectoredExceptionHandler" of Kernel32.dll / Kernel32.lib. They are not existent in the Kernel of my Win 2k, but only in my transplanted DLLs.
I also suffer a very notable performance loss using my own exe, probably because of these not native functions.

I have identified them to be part of the MinGW-64 defines, Bin, Include and Lib. I'll try to manually remove them from the MinGW files to stop the linker from adding them.
Patching the content of my MinGW-64 with old stuff from MinGW32 may do the trick better yet.
Does anyone have those files available? The installer for the old MinGW version is offline.

@Meridian, it might be you have those files for compiling.
Can you check if you have the files:
libwinpthread-1.dll
errhandlingapi.h
libkernel32.a
libntdll.a
libpthread.a
libwinpthread-1.dll
libwinpthread.a
libwinpthread-1.dll

I also added my exe with the new reaction fire system. I should be closer to OG from what I've seen in the few test I made yet.
Title: Re: Newbe needs info on where to find what in code
Post by: Meridian on April 09, 2018, 02:27:49 pm
I also suffer a very notable performance loss using my own exe, probably because of these not native functions.

The most likely reason for performance loss (and bigger size) is that you are compiling in debug mode, instead of release mode.

Could be something else too... but I wouldn't know how to help if it's not that.

I also added my exe with the new reaction fire system. I should be closer to OG from what I've seen in the few test I made yet.

Better if you share a github link.
Title: Re: Newbe needs info on where to find what in code
Post by: Yankes on April 09, 2018, 02:31:09 pm
Confusing. Using O3 -s increased the size of the exe by 0.3 MB.
Dissecting the exe, I found the main trouble to be "AddVectoredExceptionHandler" and "RemoveVectoredExceptionHandler" of Kernel32.dll / Kernel32.lib. They are not existent in the Kernel of my Win 2k, but only in my transplanted DLLs.
I also suffer a very notable performance loss using my own exe, probably because of these not native functions.

I have identified them to be part of the MinGW-64 defines, Bin, Include and Lib. I'll try to manually remove them from the MinGW files to stop the linker from adding them.
Patching the content of my MinGW-64 with old stuff from MinGW32 may do the trick better yet.
Does anyone have those files available? The installer for the old MinGW version is offline.

@Meridian, it might be you have those files for compiling.
Can you check if you have the files:
libwinpthread-1.dll
errhandlingapi.h
libkernel32.a
libntdll.a
libpthread.a
libwinpthread-1.dll
libwinpthread.a
libwinpthread-1.dll

I also added my exe with the new reaction fire system. I should be closer to OG from what I've seen in the few test I made yet.
O3 mean make code fast as possible, it sometime can reduce complex function to one line, but sometimes its can increase size (loop unrolling, cloning function and hardcoding one execution path in it, etc. )
Overall most libs you link are used because what config you choose during installation of MinGW-w64, if you switch them result could be different.
Title: Re: Newbe needs info on where to find what in code
Post by: Callahan on April 09, 2018, 02:55:14 pm
I'm using this makefile configuration as of now.
Code: [Select]
# Directories and files
OBJDIR = ../obj/
BINDIR = ../bin/
SRCS_SDL = C:/MinGW/mingw32/include/SDL/
SRCS_YAML = C:/work/yaml-cpp/
SRCS_YAML_CPP = $(wildcard $(SRCS_YAML)src/*.cpp $(SRCS_YAML)src/contrib/*.cpp)
SRCS = $(wildcard *.cpp */*.cpp */*/*.cpp)
OBJS = $(patsubst %.cpp, $(OBJDIR)%.o, $(notdir $(SRCS))) $(patsubst %.cpp, $(OBJDIR)yaml/%.o, $(notdir $(SRCS_YAML_CPP)))

BIN = OpenXcom

# Compiler settings
CXXFLAGS = -Wall -O3 -s -std=gnu++11
CXXFLAGS += -I$(SRCS_YAML)include -I$(SRCS_SDL)
ARCH ?= i686-w64-mingw32.static

LIBS = -lshlwapi -lws2_32 -lopengl32 -lglu32 -mwindows -lmingw32 -lpthread -static -static-libstdc++ -lwinmm -lSDL_gfx -lSDL_mixer -lvorbisfile -logg -lmodplug -lvorbis -logg -lFLAC -lFLAC++ -lws2_32 -lSDLmain -lSDL_Image -ljpeg -lpng12 -lz -lsmpeg -lSDL -lm -luser32 -lgdi32 -lwinmm -ldxguid -lDbgHelp

# Rules
all: $(BINDIR)$(BIN)

$(BINDIR)$(BIN): $(OBJS)
$(CXX) $(OBJS) $(LDFLAGS) $(LIBS) -o $(BINDIR)$(BIN)

$(OBJDIR)%.o:: %.cpp
$(CXX) $(CXXFLAGS) -c -o $@ $<

$(OBJDIR)%.o:: Basescape/%.cpp
$(CXX) $(CXXFLAGS) -c -o $@ $<

$(OBJDIR)%.o:: Battlescape/%.cpp
$(CXX) $(CXXFLAGS) -c -o $@ $<

$(OBJDIR)%.o:: Engine/%.cpp
$(CXX) $(CXXFLAGS) -c -o $@ $<

$(OBJDIR)%.o:: Engine/Scalers/%.cpp
$(CXX) $(CXXFLAGS) -c -o $@ $<

$(OBJDIR)%.o:: Engine/Adlib/%.cpp
$(CXX) $(CXXFLAGS) -c -o $@ $<

$(OBJDIR)%.o:: Geoscape/%.cpp
$(CXX) $(CXXFLAGS) -c -o $@ $<

$(OBJDIR)%.o:: Interface/%.cpp
$(CXX) $(CXXFLAGS) -c -o $@ $<

$(OBJDIR)%.o:: Menu/%.cpp
$(CXX) $(CXXFLAGS) -c -o $@ $<

$(OBJDIR)%.o:: Mod/%.cpp
$(CXX) $(CXXFLAGS) -c -o $@ $<

$(OBJDIR)%.o:: Savegame/%.cpp
$(CXX) $(CXXFLAGS) -c -o $@ $<

$(OBJDIR)%.o:: Ufopaedia/%.cpp
$(CXX) $(CXXFLAGS) -c -o $@ $<

$(OBJDIR)yaml/%.o:: $(SRCS_YAML)src/%.cpp
$(CXX) $(CXXFLAGS) -c -o $@ $<

$(OBJDIR)yaml/%.o:: $(SRCS_YAML)src/contrib/%.cpp
$(CXX) $(CXXFLAGS) -c -o $@ $<

clean:
rm -f $(BINDIR)$(BIN) $(OBJDIR)*.o
.PHONY: all clean

How could I switch the libs/config linked with MinGW-64. On install I did choose the default 7.3.0 version.
Or do I have to reinstall MinGW-64 to experiment with that?
I want to get rid of this kernel exception handling. It's just ballast.
Title: Re: Newbe needs info on where to find what in code
Post by: Callahan on April 09, 2018, 07:30:18 pm
Victory!!! After playing around with various MinGW-64 installs, I finally got rid of both the lag/stuttering and the VectorExceptionHandler.
Problem with the lag seemed to be caused by the Multithreading method POSIX, that was recommended on StackOverflow. Win32 Multithreading seems to be better for Win 2k.
Exception setting from Dwarf to Sjlj also helped, and is probably responsible for the removal of the hated VectorExceptionHandling.
Exe is still a bit large, but I can live with that as it seems to be unavoidable due to the compiler and the OS it is being used in.

Very special thanks to Meridian and Yankes for all the support, information, links and files that I was able to study to get to the bottom of things.

As for the reaction fire code upload - Should I upload the entire code, or just the file that got edited?
Title: Re: Newbe needs info on where to find what in code
Post by: Yankes on April 09, 2018, 11:06:07 pm
Proper way of sharing changes is publishing git commit usually through github, in this way everyone will see only what you changed.

[ps]
example: https://github.com/Yankes/OpenXcom/commit/259229d8ae8393c107cfd825f5ac60d099dbe68a commit where I add file I created for you for future use.
Title: Re: Newbe needs info on where to find what in code
Post by: Callahan on April 10, 2018, 12:18:55 pm
I put the relevant file into GitHub. Probably not using the very way you recommended, but I had no time today to read the entire beginner guide.

https://github.com/Callahan2/OXCE-Stuff
Title: Re: Newbe needs info on where to find what in code
Post by: Yankes on April 10, 2018, 03:48:34 pm
Do you have git? or you always used zip files to download source code?
If not then you should grab this: https://superuser.com/questions/1153883/git-for-windows-xp
Title: Re: Newbe needs info on where to find what in code
Post by: Callahan on April 10, 2018, 04:30:48 pm
I am using .zip files for download. That's already quite modern for me. I'm dating back from a time where "quick" code exchanges between people where made by a typewriter and a fax machine.

So, if I read this right, GIT stores data based on only storing files that got changed, and using a pointer to the old unchanged files. So one can browse forth and back between versions. Could be handy if I manage to make notable changes to the code, thanks for the link.
I'll dig into it eventually.
Title: Re: Newbe needs info on where to find what in code
Post by: Yankes on April 10, 2018, 04:47:47 pm
I am using .zip files for download. That's already quite modern for me. I'm dating back from a time where "quick" code exchanges between people where made by a typewriter and a fax machine.

So, if I read this right, GIT stores data based on only storing files that got changed, and using a pointer to the old unchanged files. So one can browse forth and back between versions. Could be handy if I manage to make notable changes to the code, thanks for the link.
I'll dig into it eventually.
small correction git store WHOLE history of project, if you download OXC repo you could go back to first version that SupSuper created :)
Another is that you can easy toggle between different version like OXC, OXCE and OXCE+ (not meeting other peoples works) and compare them and exchange changes between them.
Title: Re: Newbe needs info on where to find what in code
Post by: jgatkinsn on April 10, 2018, 06:32:59 pm
Also, if you check in your change over the original file, it's WAY easier to see the changes to the code then searching for a "callahan code" tag in the source file :)  Github will automatically highlight the differences between commits in fancy schmancy red (deletions) and green (additions) colors for all to see.

Typical github development:

Fork the project into your GitHub accounts (makes a new repository).
Clone it to your desktop
Create a new branch to make your changes
commit your changes locally
push your changes back to your github account.

Once the changes are pushed, you could potentially create a "pull request" back to the main project that you forked from, and the maintainers of the project can review your pull request to see if they want to accept your changes or not.  It acts as a code review, and you can continue to update the pull request by push changes into the branch that the pull request originated from.

If the PR (pull request) gets accepted, you can delete your branch if you want.



However, working in OXCE+ is not typical since it's already a fork of an existing GitHub project (OXC+OXCE), and Meridian prefers to cherry-pick changes without pull requests.

So, I've forked from original OXC project.
Cloned it to desktop
Created an oxce3.5-plus-proto branch
Added Meridian's repo as remote branch to my project
switched to my oxce3.5-plus-proto branch and pulled down Meridian's oxce3.5-proto-branch into my branch (not a merge per se, but direct full copy of branch - have to look up the git commands again).
I use my  oxce3.5-plus-proto branch as a starting point to make other branches if I'm making changes to OXCE+.
Title: Re: Newbe needs info on where to find what in code
Post by: Callahan on April 11, 2018, 10:28:27 am
Thanks for the explanations. For a beginner, this all does sound a bit complicated. Once I grow familiar with it, it will better understand the interaction of forks, branches and the other stuff.
I'm going to make this step by step. I've started to take a look at some of the mods and rules to see how these work and what is possible.