Author Topic: Segmentation-fault  (Read 5904 times)

Offline Kjotleik

  • Colonel
  • ****
  • Posts: 100
  • I am Kjotleik
    • View Profile
Segmentation-fault
« on: May 29, 2018, 06:33:57 pm »
Hello.

I'm having a slight issue with a segmentation fault that I seem not to be able to track down.

nightly 2018-05-10 20:33

This item is taken from Dioxine's X-Piratez mod.
I have changed it to use it with FMP 2.0b.

Code: [Select]
  - type: STR_AUTO_AXE
    requires:
      - STR_AUTO_AXE
    size: 0.6
    costSell: 32000
    weight: 16
    bigSprite: 411
    floorSprite: 253
    handSprite: 742
    bulletSprite: 5
    fireSound: 108
    hitSound: 39
    hitAnimation: 0
    power: 120
    damageType: 7
    accuracyAuto: 100
    tuAuto: 16
    flatRate: true
    clipSize: -1
    battleType: 1
    twoHanded: true
    invWidth: 2
    invHeight: 3
    armor: 30
    maxRange: 1
    bulletSpeed: 50
    autoShots: 4
    attraction: 6
    listOrder: 1909


Spoiler details:
WHAT I DO

Start up OpenXCom, with mods.
Go into NEW BATTLE, equip my soldiers and start the battle.


WHAT HAPPENS


I have the item in my hand. Everything is fine.
I move one tile forward (down on the ramp). Everything is fine.
I try to turn. I get a segmentation fault.

The game tells me something is missing from a mod.
Unfortunately, the openxcom.log file is unable to tell me more. It just states the above sentence, and that is all.

I also try to throw a primed smoke grenade. As long as the soldier doesn't turn, all is well.
But when I try to throw the smoke inside the craft (and the soldier needs to turn) I get the segmentation fault.


WHAT I DID NEXT
First: Removed every mod and added them back - one by one, starting with FMP 2.0b - and chose NEW BATTLE with an auto-cannon and smoke grenades.
All mods loaded fine, and NEW BATTLE gave no crashes.

Checked extraSprites for BIGOB, FLOOROB and HANDOB. Numbers for bigSprite, floorSprite and handSprite are all correct. And graphics files are in place.
Checked ExtraSounds for soundfile. Number for fireSound is correct. Wav-file in place in correct folder.
Checked FMP-files for used hitSound and hitAnimation values. Changed them to same as Machete/Knife.

Tried to include a "costBuy: 0" line. Removed it again. It should not matter. And it didn't.
Tried damageType: 1 and battleType: 3. Changed back to 7 and 1 after confirming it didn't help.

Everything is ok when loading the game. This new "Chrys-Ax" of mine (Auto-Ax in X-Piratez) has a nice UFOPaedia article. I can research and manufacture it (if I have the necessary prerequisites to do so).


Would be nice if someone could tell me where I should look next.
I'm sure (well, as sure as one can be messing around in rul-files) that it is only this item that is causing the problem.
But why?
What is missing?
 :(


Offline Meridian

  • Global Moderator
  • Commander
  • *****
  • Posts: 9084
    • View Profile
Re: Segmentation-fault
« Reply #1 on: May 29, 2018, 06:38:38 pm »
There is nothing wrong with the ruleset.

1/ Click on "Randomize" button in New Battle (this deletes old settings, which might conflict) and try again...

2/ If it doesn't work, upload the whole mod, not just the ruleset... and preferably also a save.

Offline Kjotleik

  • Colonel
  • ****
  • Posts: 100
  • I am Kjotleik
    • View Profile
Re: Segmentation-fault
« Reply #2 on: May 29, 2018, 07:18:40 pm »
Thanks.

I got the crash again, so attached is the K's FMP Addon mod and a save-file.

Mods used in save-game:
Nightly 2018-05-10 20:33
FMP 2.0b
K's FMP Addon


The save is on first turn of a mission.
One soldier with Chrys-Ax in hand.
If I turn, I get the segmentation-fault.


I would be grateful for any insights into what causes this.
I'm blank myself at the moment.

Offline ohartenstein23

  • Commander
  • *****
  • Posts: 1933
  • Flamethrowers fry cyberdisk circuits
    • View Profile
Re: Segmentation-fault
« Reply #3 on: May 29, 2018, 07:27:51 pm »
The HANDOB.PCK portion of your extraSprites ruleset is a mess - this is probably what is causing the issue as turning a unit picks a different frame from the handSprite.  First off, you should only have one "- type: HANDOB.PCK" in your file, having two can cause loading issues.  I recommend combining them into one entry.  Second is that each hand sprite has 8 images and therefore takes up 8 sprite indexes; by having one image defined as index 740 and the next defined as 741, you're replacing seven of the frames from the first set with those of the second set.  Each new file should be 8 indexes apart (740, 748, 756, etc.).

Offline Kjotleik

  • Colonel
  • ****
  • Posts: 100
  • I am Kjotleik
    • View Profile
Re: Segmentation-fault
« Reply #4 on: May 29, 2018, 08:00:44 pm »
@ohartenstein23

Thanks.

I've now merged the two HANDOB.PCK sections into one.
And I've indexed them ten apart (easier in my head than eight apart - might re-do once I get it working).


Still getting this segmentation-fault, though.

I'll be at it for one more hour, I think.
Then it will have to wait for the weekend.

Maybe a fresh mind will make me see the light...

Offline Meridian

  • Global Moderator
  • Commander
  • *****
  • Posts: 9084
    • View Profile
Re: Segmentation-fault
« Reply #5 on: May 29, 2018, 09:15:42 pm »
You're missing handob size and partitioning definition.
And as Oharty said... better create just one handob section; and definitely space them by 8 or more otherwise they will overwrite each other

Code: [Select]
  - type: HANDOB.PCK
    width: 256                   # <-------------- was missing
    height: 40                   # <-------------- was missing
    subX: 32                     # <-------------- was missing
    subY: 40                     # <-------------- was missing
    files:
      740: Resources/HANDOB/HANDOB_LARGE_ROCKET.GIF
      741: Resources/HANDOB/HANDOB_SMOKE_ROCKET.GIF
      742: Resources/HANDOB/AutoAxe.png
      100168: Resources/HANDOB/FireBomb.png
« Last Edit: May 29, 2018, 09:17:55 pm by Meridian »

Offline Kjotleik

  • Colonel
  • ****
  • Posts: 100
  • I am Kjotleik
    • View Profile
Re: Segmentation-fault
« Reply #6 on: May 29, 2018, 10:40:29 pm »
You're missing handob size and partitioning definition.

Thank you.

That fixed it.

You just saved me countless hours of thinking, tinkering and testing.

I'm happy!!

 :)